Merge pull request #239 from creative-commoners/pulls/3.1/add-7.2

Add PHP 7.2 to Travis build matrix, add individual phpcs ruleset
This commit is contained in:
Daniel Hensby 2018-01-26 13:48:10 +00:00 committed by GitHub
commit 4955b9c4b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 11 deletions

View File

@ -12,6 +12,8 @@ matrix:
env: DB=PGSQL PHPUNIT_TEST=1 env: DB=PGSQL PHPUNIT_TEST=1
- php: 7.1 - php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
- php: 7.2
env: DB=MYSQL PHPUNIT_TEST=1
before_script: before_script:
- phpenv rehash - phpenv rehash
@ -25,7 +27,7 @@ before_script:
script: script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/ *.php; fi
after_success: after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi

9
phpcs.xml.dist Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
</rule>
</ruleset>

View File

@ -5,8 +5,8 @@ namespace Symbiote\GridFieldExtensions;
use Exception; use Exception;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridState_Data; use SilverStripe\Forms\GridField\GridState_Data;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\Limitable; use SilverStripe\ORM\Limitable;
@ -269,7 +269,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
* {@inheritDoc} * {@inheritDoc}
* *
* @param GridField $gridField * @param GridField $gridField
* @return ArrayList|null * @return ArrayData|null
*/ */
public function getTemplateParameters(GridField $gridField) public function getTemplateParameters(GridField $gridField)
{ {
@ -281,7 +281,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
// Figure out which page and record range we're on // Figure out which page and record range we're on
if (!$arguments['total-rows']) { if (!$arguments['total-rows']) {
return; return null;
} }
// Define a list of the FormActions that should be generated for pager controls (see getPagerActions()) // Define a list of the FormActions that should be generated for pager controls (see getPagerActions())
@ -289,13 +289,15 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
'first' => array( 'first' => array(
'title' => 'First', 'title' => 'First',
'args' => array('first-shown' => 1), 'args' => array('first-shown' => 1),
'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left ss-gridfield-firstpage', 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left '
. 'ss-gridfield-firstpage',
'disable-previous' => ($this->getCurrentPage() == 1) 'disable-previous' => ($this->getCurrentPage() == 1)
), ),
'prev' => array( 'prev' => array(
'title' => 'Previous', 'title' => 'Previous',
'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()), 'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()),
'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left ss-gridfield-previouspage', 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left '
. 'ss-gridfield-previouspage',
'disable-previous' => ($this->getCurrentPage() == 1) 'disable-previous' => ($this->getCurrentPage() == 1)
), ),
'next' => array( 'next' => array(
@ -307,7 +309,8 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
'last' => array( 'last' => array(
'title' => 'Last', 'title' => 'Last',
'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1), 'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1),
'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right ss-gridfield-lastpage', 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right '
. 'ss-gridfield-lastpage',
'disable-next' => ($this->getCurrentPage() == $arguments['total-pages']) 'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
), ),
'pagesize' => array( 'pagesize' => array(

View File

@ -11,17 +11,17 @@ use SilverStripe\Forms\GridField\GridField_DataManipulator;
use SilverStripe\Forms\GridField\GridField_HTMLProvider; use SilverStripe\Forms\GridField\GridField_HTMLProvider;
use SilverStripe\Forms\GridField\GridField_SaveHandler; use SilverStripe\Forms\GridField\GridField_SaveHandler;
use SilverStripe\Forms\GridField\GridField_URLHandler; use SilverStripe\Forms\GridField\GridField_URLHandler;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\SS_List; use SilverStripe\ORM\SS_List;
use SilverStripe\ORM\SS_Map; use SilverStripe\ORM\SS_Map;
use SilverStripe\View\ViewableData; use SilverStripe\View\ViewableData;
use Exception;
/** /**
* Allows grid field rows to be re-ordered via drag and drop. Both normal data * Allows grid field rows to be re-ordered via drag and drop. Both normal data
@ -363,7 +363,7 @@ class GridFieldOrderableRows extends RequestHandler implements
*/ */
public function handleMoveToPage(GridField $grid, $request) public function handleMoveToPage(GridField $grid, $request)
{ {
if (!$paginator = $grid->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldPaginator')) { if (!$paginator = $grid->getConfig()->getComponentByType(GridFieldPaginator::class)) {
$this->httpError(404, 'Paginator component not found'); $this->httpError(404, 'Paginator component not found');
} }