diff --git a/.travis.yml b/.travis.yml index ca9897f..1a2cfe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ -sudo: false - language: php + php: - hhvm - 7 @@ -11,7 +10,7 @@ before_script: script: - mkdir -p build/logs - - phpunit -c tests/phpunit.xml --coverage-clover build/logs/clover.xml tests + - php vendor/bin/phpunit -c tests/phpunit.xml --coverage-clover build/logs/clover.xml tests after_script: - php ./vendor/bin/coveralls -v diff --git a/composer.json b/composer.json index e81b53c..d76cd49 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,16 @@ "sebastian/diff": "^1.4" }, "require-dev": { - "phpunit/phpunit": "5.4.*" + "phpunit/phpunit": "^5.5" }, "autoload": { "psr-4": { "Sokil\\Diff\\": "src/" } + }, + "autoload-dev": { + "psr-4": { + "Sokil\\Diff\\": "tests/" + } } } diff --git a/src/Change.php b/src/Change.php index 4c5d2f2..6c978aa 100644 --- a/src/Change.php +++ b/src/Change.php @@ -39,4 +39,4 @@ public function getNewValue() { return $this->newValue; } -} \ No newline at end of file +} diff --git a/src/Renderer.php b/src/Renderer.php index dc135ae..d094ed0 100644 --- a/src/Renderer.php +++ b/src/Renderer.php @@ -130,4 +130,4 @@ public function render(Change $change) // build diff return implode(PHP_EOL, $diff); } -} \ No newline at end of file +} diff --git a/tests/RendererTest.php b/tests/RendererTest.php index 43bd098..a9388a4 100644 --- a/tests/RendererTest.php +++ b/tests/RendererTest.php @@ -2,7 +2,9 @@ namespace Sokil\Diff; -class RendererTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class RendererTest extends TestCase { public function renderChangeDataProvider() { @@ -117,4 +119,26 @@ public function testRender_ChangeValueHasStringType( $this->assertEquals($expectedDiff, $actualDiff); } -} \ No newline at end of file + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid format specified + */ + public function testSetFormatWithInvalidType() + { + $diffRenderer = new Renderer([]); + + $diffRenderer->setFormat('not_array_type'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid format specified + */ + public function testSetFormatWithInvalidDefinedFormats() + { + $diffRenderer = new Renderer([]); + + $diffRenderer->setFormat(1000); + } + +} diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 4150acd..9ee752e 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -2,7 +2,12 @@ - . + ./ - \ No newline at end of file + + + ../src + + +