diff --git a/composer.json b/composer.json index 2cf9d90..8c7107a 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "cheppers/git-hooks": "^0.0.8", "cheppers/robo-phpcs": "^0.0.4", "codeception/codeception": "^2.2", - "squizlabs/php_codesniffer": "2.6.2", "symfony/process": "^2.8|^3.1" }, "autoload": { diff --git a/composer.lock b/composer.lock index 06c7754..b38df3e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e923f5a7cb3779593200d776fc3f6598", - "content-hash": "3abe6d1f1af8a786143d24d26f58f140", + "hash": "f3bede9cae0b2f6eb8930ff55257d091", + "content-hash": "9918e697a3bbc75a52d4702f8a3a6e41", "packages": [ { "name": "cheppers/asset-jar", @@ -2459,16 +2459,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83" + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/squizlabs/PHP_CodeSniffer/zipball/4edb770cb853def6e60c93abb088ad5ac2010c83", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83", + "url": "https://github.com/gitapi/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", "shasum": "" }, "require": { @@ -2533,7 +2533,7 @@ "phpcs", "standards" ], - "time": "2016-07-13 23:29:13" + "time": "2016-09-01 23:53:02" }, { "name": "symfony/browser-kit", diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 4c7dcbb..8ce6e7a 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -1,5 +1,6 @@ in($reportsDir); + foreach ($finder->files() as $file) { + unlink($file->getPathname()); + } + } + + return $this; + } + + /** + * @param string $taskName + * + * @return $this + */ + public function runRoboTask($taskName) + { + $cmd = sprintf( + 'cd tests/_data && ../../bin/robo %s', + escapeshellarg($taskName) + ); + + $this->runShellCommand($cmd); + + return $this; + } + + /** + * @param string $expected + * + * @return $this + */ + public function seeThisTextInTheStdOutput($expected) + { + Assert::assertContains($expected, $this->getStdOutput()); + + return $this; + } + + /** + * @param string $expected + * + * @return $this + */ + public function seeThisTextInTheStdError($expected) + { + Assert::assertContains($expected, $this->getStdError()); + + return $this; + } + + /** + * @param int $expected + * + * @return $this + */ + public function theExitCodeShouldBe($expected) + { + Assert::assertEquals($expected, $this->getExitCode()); + + return $this; + } } diff --git a/tests/acceptance/LintVerboseCept.php b/tests/acceptance/LintVerboseCept.php index 4e78a3f..a1fcaa6 100644 --- a/tests/acceptance/LintVerboseCept.php +++ b/tests/acceptance/LintVerboseCept.php @@ -1,21 +1,13 @@ wantTo('tslint --format verbose'); -$cmd = sprintf('bin/robo --load-from %s lint:verbose', escapeshellarg($dataDir)); -$i->runShellCommand($cmd); -Assert::assertContains( - '(whitespace) samples/invalid-01.d.ts[5, 16]: missing whitespace', - $i->getStdOutput() -); -Assert::assertContains( - '(whitespace) samples/invalid-02.d.ts[5, 16]: missing whitespace', - $i->getStdOutput() -); + +$i->runRoboTask('lint:verbose'); +$i->theExitCodeShouldBe(2); +$i->seeThisTextInTheStdOutput('(whitespace) samples/invalid-01.d.ts[5, 16]: missing whitespace'); +$i->seeThisTextInTheStdOutput('(whitespace) samples/invalid-02.d.ts[5, 16]: missing whitespace'); diff --git a/tests/acceptance/LintWithJarCept.php b/tests/acceptance/LintWithJarCept.php index 517e748..37c2e81 100644 --- a/tests/acceptance/LintWithJarCept.php +++ b/tests/acceptance/LintWithJarCept.php @@ -1,18 +1,11 @@ wantTo('tslint --format yaml | tslint-formatters yaml2jsonGroupByFiles'); -$i->runShellCommand($cmd); -Assert::assertEquals(1, $i->getExitCode()); -Assert::assertContains( - 'One or more errors were reported (and any number of warnings)', - $i->getStdError() -); +$i->runRoboTask('lint:with-jar'); +$i->theExitCodeShouldBe(1); +$i->seeThisTextInTheStdError('One or more errors were reported (and any number of warnings)');