Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/1061-fix-php-74-notifications'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcyr committed Oct 4, 2021
2 parents 96bba5a + 4653531 commit fbdc271
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Grid/Column/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,12 @@ public function getData()
$result = [];

$hasValue = false;
if ($this->data['from'] != $this::DEFAULT_VALUE) {
if (isset($this->data['from']) && $this->data['from'] != $this::DEFAULT_VALUE) {
$result['from'] = $this->data['from'];
$hasValue = true;
}

if ($this->data['to'] != $this::DEFAULT_VALUE) {
if (isset($this->data['to']) && $this->data['to'] != $this::DEFAULT_VALUE) {
$result['to'] = $this->data['to'];
$hasValue = true;
}
Expand Down Expand Up @@ -687,7 +687,7 @@ public function getFilters($source)
{
$filters = [];

if ($this->hasOperator($this->data['operator'])) {
if (isset($this->data) && $this->hasOperator($this->data['operator'])) {
if ($this instanceof ArrayColumn && in_array($this->data['operator'], [self::OPERATOR_EQ, self::OPERATOR_NEQ])) {
$filters[] = new Filter($this->data['operator'], $this->data['from']);
} else {
Expand Down
22 changes: 22 additions & 0 deletions Tests/Grid/Column/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,28 @@ public function testGetEmptyDataIfOperatorNotNotNullOrNullNoFromToValues()
}
}

public function testGetNullData()
{
$mock = $this->getMockForAbstractClass(Column::class);

try {
$mock->getData();
} catch (\Exception $exception) {
$this->fail($exception->getMessage());
}
}

public function testGetFiltersWithoutData()
{
$mock = $this->getMockForAbstractClass(Column::class);

try {
$mock->getFilters('aSource');
} catch (\Exception $exception) {
$this->fail($exception->getMessage());
}
}

public function testGetData()
{
$mock = $this->getMockForAbstractClass(Column::class);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Grid/Column/TextColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use APY\DataGridBundle\Grid\Column\Column;
use APY\DataGridBundle\Grid\Column\TextColumn;
use APY\DataGridBundle\Grid\Filter;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use PHPUnit\Framework\TestCase;

class TextColumnTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Grid/GridTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use APY\DataGridBundle\Grid\Source\Entity;
use APY\DataGridBundle\Grid\Source\Source;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\ParameterBag;
Expand Down

0 comments on commit fbdc271

Please sign in to comment.