-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from girorme/feature/add-phpunit
Add phpunit
- Loading branch information
Showing
10 changed files
with
176 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.result.* | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="SupperGiggle Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="tap" target="build/report.tap"/> | ||
<log type="junit" target="build/report.junit.xml"/> | ||
<log type="coverage-html" target="build/coverage" lowUpperBound="35" highLowerBound="70"/> | ||
<log type="coverage-text" target="build/coverage.txt"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
</logging> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace SuperGiggle; | ||
|
||
class Os | ||
{ | ||
|
||
|
||
/** | ||
* Is the current platform windows? | ||
* | ||
* @return boolean | ||
*/ | ||
public function isWindows() | ||
{ | ||
return (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace SuperGiggle; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class UtilTest extends TestCase | ||
{ | ||
|
||
|
||
/** | ||
* Define if the object can be constructed | ||
* | ||
* @test | ||
* | ||
* @return void | ||
*/ | ||
public function objectCanBeConstructed() | ||
{ | ||
$util = new Util(); | ||
$this->assertInstanceOf(Util::class, $util); | ||
} | ||
|
||
|
||
/** | ||
* Test if directory is ok to windows platform | ||
* | ||
* @test | ||
* | ||
* @return void | ||
*/ | ||
public function phpCsBinaryOnWindows() | ||
{ | ||
$os = $this->createMock(Os::class); | ||
$os->method('isWindows') | ||
->willReturn(true); | ||
|
||
$util = new Util(); | ||
$util->setOs($os); | ||
|
||
$this->assertStringContainsString('/../vendor/bin/phpcs.bat', $util->getPhpCsBinary()); | ||
} | ||
|
||
|
||
/** | ||
* Test if directory is ok to linux platform | ||
* | ||
* @test | ||
* | ||
* @return void | ||
*/ | ||
public function phpCsBinaryOnLinux() | ||
{ | ||
$os = $this->createMock(Os::class); | ||
|
||
$util = new Util(); | ||
$util->setOs($os); | ||
|
||
$this->assertStringContainsString('/../vendor/bin/phpcs', $util->getPhpCsBinary()); | ||
} | ||
|
||
|
||
} |