Skip to content

Commit

Permalink
Merge pull request #44 from Gamesh/master
Browse files Browse the repository at this point in the history
updated phpcs to ^v3.2.1 fixes issue https://github.com/squizlabs/PHP…
  • Loading branch information
CMalvika authored Dec 20, 2017
2 parents cd5a8b7 + 9c72425 commit fba9e4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"php": "~7.1",
"squizlabs/php_codesniffer": "~3",
"squizlabs/php_codesniffer": "^3.2.1",
"doctrine/annotations": "^1.4"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@ class ControllerMethodsConventionSniffTest extends AbstractTestCase
public function testWebControllerConventions(): void
{
$file = __DIR__ . '/Fixtures/InterNations/Bundle/SomethingBundle/Controller/TestController.php';
$errors = $this->analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);
$errors = static::analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);

$this->assertReportCount(1, 0, $errors, $file);
$this->assertReportContains(
static::assertReportCount(1, 0, $errors, $file);
static::assertReportContains(
$errors,
$file,
'errors',
'Public methods in web controllers are limited to "deleteAction()", "editAction()", "getAction()", "indexAction()", "newAction()", "patchAction()", "postAction()", "putAction()" but "invalidAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies it’s own controller and should be extracted into it’s own controller.'
'Public methods in web controllers are limited to "deleteAction()", "editAction()", "getAction()", "indexAction()", "newAction()", "patchAction()", "postAction()", "putAction()" but "invalidAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies its own controller and should be extracted into its own controller.'
);
}

public function testNonControllersAreIgnored(): void
{
$file = __DIR__ . '/Fixtures/InterNations/Bundle/SomethingBundle/Controller/Ignored.php';
$errors = $this->analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);
$errors = static::analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);

$this->assertReportCount(0, 0, $errors, $file);
static::assertReportCount(0, 0, $errors, $file);
}

public function testApiControllerConventions(): void
{
$file = __DIR__ . '/Fixtures/InterNations/Bundle/SomethingBundle/Controller/Api/TestController.php';
$errors = $this->analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);
$errors = static::analyze(['InterNations/Sniffs/Architecture/ControllerMethodsConventionSniff'], [$file]);

$this->assertReportCount(3, 0, $errors, $file);
$this->assertReportContains(
static::assertReportCount(3, 0, $errors, $file);
static::assertReportContains(
$errors,
$file,
'errors',
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "newAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies it’s own controller and should be extracted into it’s own controller.'
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "newAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies its own controller and should be extracted into its own controller.'
);
$this->assertReportContains(
static::assertReportContains(
$errors,
$file,
'errors',
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "editAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies it’s own controller and should be extracted into it’s own controller.'
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "editAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies its own controller and should be extracted into its own controller.'
);
$this->assertReportContains(
static::assertReportContains(
$errors,
$file,
'errors',
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "invalidAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies it’s own controller and should be extracted into it’s own controller.'
'Public methods in API controllers are limited to "deleteAction()", "getAction()", "indexAction()", "patchAction()", "postAction()", "putAction()" but "invalidAction()" found. This is often a hint that you are dealing with a sub resource of the current resource that justifies its own controller and should be extracted into its own controller.'
);
}
}

0 comments on commit fba9e4f

Please sign in to comment.