Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Datatable/Filter/SelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 0 additions & 6 deletions Tests/Column/ArrayColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@
*/
final class ArrayColumnTest extends \PHPUnit\Framework\TestCase
{
/**
* testCreate.
*/
public function testIsAssociative()
{
$arrayColumn = new ArrayColumn();
static::assertFalse($this->callMethod($arrayColumn, 'isAssociative', [['a', 'b']]));
static::assertTrue($this->callMethod($arrayColumn, 'isAssociative', [['a' => 1, 'b' => 1]]));
}

/**
* testCreate.
*/
public function testArrayToString()
{
$arrayColumn = new ArrayColumn();
Expand Down
3 changes: 0 additions & 3 deletions Tests/DatatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*/
final class DatatableTest extends \PHPUnit\Framework\TestCase
{
/**
* testCreate.
*/
public function testCreate()
{
$tableClass = PostDatatable::class;
Expand Down
33 changes: 33 additions & 0 deletions Tests/Datatables/PostDatatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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',
])
;
}

Expand Down
8 changes: 1 addition & 7 deletions Tests/Response/DatatableQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\\": "" }
}
}