diff --git a/.travis.yml b/.travis.yml index 15ea59f7..5d1112dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,21 +9,26 @@ cache: matrix: fast_finish: true include: - - php: 7.1 - env: DEPENDENCIES=beta + - php: 7.2 + env: DEPENDENCIES=beta SYMFONY_REQUIRE="3.4.*" + - php: 7.2 + env: DEPENDENCIES=beta SYMFONY_REQUIRE="4.3.*" + - php: 7.3 + env: DEPENDENCIES=beta SYMFONY_REQUIRE="3.4.*" + - php: 7.3 + env: DEPENDENCIES=beta SYMFONY_REQUIRE="4.3.*" - php: hhvm allow_failures: - php: hhvm env: - - SYMFONY_VERSION="3.0.*" DEPENDENCIES=dev COMPOSER_FLAGS="--prefer-stable" + - SYMFONY_REQUIRE="3.4.*" DEPENDENCIES=dev COMPOSER_FLAGS="--prefer-stable" before_install: - composer self-update - - if [ "$DEPENDENCIES" = "beta" ]; then composer config minimum-stability beta; fi; - - if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update symfony/framework-bundle=$SYMFONY_VERSION; fi + - composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master + - if [ "$DEPENDENCIES" = "beta" ]; then composer config minimum-stability beta; fi; - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; - - composer require --dev "phpunit/phpunit=5.7.*" install: composer update --prefer-dist --no-interaction $COMPOSER_FLAGS diff --git a/Datatable/Filter/SelectFilter.php b/Datatable/Filter/SelectFilter.php index ca76f067..d6d38031 100644 --- a/Datatable/Filter/SelectFilter.php +++ b/Datatable/Filter/SelectFilter.php @@ -171,7 +171,7 @@ public function setMultiple($multiple) /** * @throws Exception */ - private function setSelectSearchType(string $searchValue) + private function setSelectSearchType(string $searchValue): void { $searchTypesCount = \count($this->selectSearchTypes); diff --git a/Tests/Column/ArrayColumnTest.php b/Tests/Column/ArrayColumnTest.php index 682797e0..9a7423f9 100644 --- a/Tests/Column/ArrayColumnTest.php +++ b/Tests/Column/ArrayColumnTest.php @@ -19,9 +19,6 @@ */ final class ArrayColumnTest extends \PHPUnit\Framework\TestCase { - /** - * testCreate. - */ public function testIsAssociative() { $arrayColumn = new ArrayColumn(); @@ -29,9 +26,6 @@ public function testIsAssociative() static::assertTrue($this->callMethod($arrayColumn, 'isAssociative', [['a' => 1, 'b' => 1]])); } - /** - * testCreate. - */ public function testArrayToString() { $arrayColumn = new ArrayColumn(); diff --git a/Tests/DatatableTest.php b/Tests/DatatableTest.php index 5de5dda4..360134aa 100644 --- a/Tests/DatatableTest.php +++ b/Tests/DatatableTest.php @@ -25,9 +25,6 @@ */ final class DatatableTest extends \PHPUnit\Framework\TestCase { - /** - * testCreate. - */ public function testCreate() { $tableClass = PostDatatable::class; diff --git a/Tests/Datatables/PostDatatable.php b/Tests/Datatables/PostDatatable.php index 8fa0483b..06462486 100644 --- a/Tests/Datatables/PostDatatable.php +++ b/Tests/Datatables/PostDatatable.php @@ -12,7 +12,14 @@ namespace Sg\DatatablesBundle\Tests\Datatables; use Sg\DatatablesBundle\Datatable\AbstractDatatable; +use Sg\DatatablesBundle\Datatable\Column\ActionColumn; +use Sg\DatatablesBundle\Datatable\Column\AttributeColumn; +use Sg\DatatablesBundle\Datatable\Column\BooleanColumn; use Sg\DatatablesBundle\Datatable\Column\Column; +use Sg\DatatablesBundle\Datatable\Column\DateTimeColumn; +use Sg\DatatablesBundle\Datatable\Column\ImageColumn; +use Sg\DatatablesBundle\Datatable\Column\NumberColumn; +use Sg\DatatablesBundle\Datatable\Column\VirtualColumn; class PostDatatable extends AbstractDatatable { @@ -37,6 +44,32 @@ public function buildDatatable(array $options = []) ->add('title', Column::class, [ 'title' => 'Title', ]) + ->add('boolean', BooleanColumn::class, [ + 'title' => 'Boolean', + ]) + ->add('attribute', AttributeColumn::class, [ + 'title' => 'Attribute', + ]) + ->add('datetime', DateTimeColumn::class, [ + 'title' => 'DateTimeColumn', + ]) + ->add('image', ImageColumn::class, [ + 'title' => 'ImageColumn', + 'imagine_filter' => '', + 'relative_path' => '', + ]) + ->add(null, ActionColumn::class, [ + 'title' => 'ActionColumn', + 'actions' => [ + ], + ]) + ->add('number', NumberColumn::class, [ + 'title' => 'NumberColumn', + 'formatter' => new \NumberFormatter('en_US', \NumberFormatter::DECIMAL), + ]) + ->add('virtual', VirtualColumn::class, [ + 'title' => 'VirtualColumn', + ]) ; } diff --git a/Tests/Response/DatatableQueryBuilderTest.php b/Tests/Response/DatatableQueryBuilderTest.php index 568ee2e2..0cd77230 100644 --- a/Tests/Response/DatatableQueryBuilderTest.php +++ b/Tests/Response/DatatableQueryBuilderTest.php @@ -100,13 +100,7 @@ public function testUsingTheSortNameWhenShortNameIsNotAReservedWord() $this->getDataTableQueryBuilder($entityName, $shortName); } - /** - * @param string $entityName - * @param string $shortName - * - * @return DatatableQueryBuilder - */ - private function getDataTableQueryBuilder($entityName, $shortName) + private function getDataTableQueryBuilder(string $entityName, string $shortName): DatatableQueryBuilder { $this->reflectionClass->getShortName()->willReturn($shortName); $this->classMetadata->getReflectionClass()->willReturn($this->reflectionClass->reveal()); diff --git a/composer.json b/composer.json index c024bf22..f3acd27e 100644 --- a/composer.json +++ b/composer.json @@ -19,16 +19,20 @@ }, "require": { "php": ">=7.1", - "symfony/framework-bundle": "^3.0|^4.0", "doctrine/orm": "^2.5", - "symfony/options-resolver": "^3.0|^4.0", - "symfony/property-access": "^3.0|^4.0", - "friendsofsymfony/jsrouting-bundle": "^1.6|^2.0" - }, - "autoload": { - "psr-4": { "Sg\\DatatablesBundle\\": "" } + "friendsofsymfony/jsrouting-bundle": "^1.6|^2.0", + "symfony/framework-bundle": "^3.4|^4.1", + "symfony/options-resolver": "^3.4|^4.1", + "symfony/property-access": "^3.4|^4.1", + "symfony/security": "^3.4|^4.1", + "symfony/translation": "^3.4|^4.1", + "twig/twig": "^2.9" }, "require-dev": { + "phpunit/phpunit": "5.7.*", "friendsofphp/php-cs-fixer": "^2.15" + }, + "autoload": { + "psr-4": { "Sg\\DatatablesBundle\\": "" } } }