Composer lint

This commit is contained in:
Will Rossiter 2017-09-14 09:41:11 +12:00
parent 82c139e30a
commit 0c964d1ed8
4 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.sass-cache .sass-cache
/.php_cs.cache

View File

@ -16,13 +16,17 @@
"silverstripe/cms": "The SilverStripe Content Management System" "silverstripe/cms": "The SilverStripe Content Management System"
}, },
"require-dev": { "require-dev": {
"phpunit/PHPUnit": "~4.8" "phpunit/PHPUnit": "^5.7"
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.x-dev" "dev-master": "3.x-dev"
} }
}, },
"scripts": {
"lint": "phpcs src/ tests/",
"fix": "php-cs-fixer fix src/ && php-cs-fixer fix tests/"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"SilverStripe\\Comments\\": "src/", "SilverStripe\\Comments\\": "src/",

View File

@ -19,7 +19,6 @@ use SilverStripe\Security\Security;
*/ */
class CommentAdmin extends LeftAndMain implements PermissionProvider class CommentAdmin extends LeftAndMain implements PermissionProvider
{ {
private static $url_segment = 'comments'; private static $url_segment = 'comments';
private static $url_rule = '/$Action'; private static $url_rule = '/$Action';
@ -97,13 +96,19 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider
$fields = new FieldList( $fields = new FieldList(
$root = new TabSet( $root = new TabSet(
'Root', 'Root',
new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount, new Tab(
'NewComments',
_t('CommentAdmin.NewComments', 'New') . ' ' . $newCount,
$newGrid $newGrid
), ),
new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount, new Tab(
'ApprovedComments',
_t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount,
$approvedGrid $approvedGrid
), ),
new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount, new Tab(
'SpamComments',
_t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
$spamGrid $spamGrid
) )
) )

View File

@ -143,7 +143,8 @@ class CommentingControllerTest extends FunctionalTest
// comments sitewide // comments sitewide
$response = $this->get('comments/rss'); $response = $this->get('comments/rss');
$this->assertEquals(10, substr_count($response->getBody(), "<item>"), "10 approved, non spam comments on page 1"); $comment = "10 approved, non spam comments on page 1";
$this->assertEquals(10, substr_count($response->getBody(), "<item>"), $comment);
$response = $this->get('comments/rss?start=10'); $response = $this->get('comments/rss?start=10');
$this->assertEquals(4, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2"); $this->assertEquals(4, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");