Skip to content

Commit fbdc271

Browse files
author
tomcyr
committed
Merge remote-tracking branch 'upstream/1061-fix-php-74-notifications'
2 parents 96bba5a + 4653531 commit fbdc271

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

Grid/Column/Column.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,12 @@ public function getData()
528528
$result = [];
529529

530530
$hasValue = false;
531-
if ($this->data['from'] != $this::DEFAULT_VALUE) {
531+
if (isset($this->data['from']) && $this->data['from'] != $this::DEFAULT_VALUE) {
532532
$result['from'] = $this->data['from'];
533533
$hasValue = true;
534534
}
535535

536-
if ($this->data['to'] != $this::DEFAULT_VALUE) {
536+
if (isset($this->data['to']) && $this->data['to'] != $this::DEFAULT_VALUE) {
537537
$result['to'] = $this->data['to'];
538538
$hasValue = true;
539539
}
@@ -687,7 +687,7 @@ public function getFilters($source)
687687
{
688688
$filters = [];
689689

690-
if ($this->hasOperator($this->data['operator'])) {
690+
if (isset($this->data) && $this->hasOperator($this->data['operator'])) {
691691
if ($this instanceof ArrayColumn && in_array($this->data['operator'], [self::OPERATOR_EQ, self::OPERATOR_NEQ])) {
692692
$filters[] = new Filter($this->data['operator'], $this->data['from']);
693693
} else {

Tests/Grid/Column/ColumnTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,28 @@ public function testGetEmptyDataIfOperatorNotNotNullOrNullNoFromToValues()
677677
}
678678
}
679679

680+
public function testGetNullData()
681+
{
682+
$mock = $this->getMockForAbstractClass(Column::class);
683+
684+
try {
685+
$mock->getData();
686+
} catch (\Exception $exception) {
687+
$this->fail($exception->getMessage());
688+
}
689+
}
690+
691+
public function testGetFiltersWithoutData()
692+
{
693+
$mock = $this->getMockForAbstractClass(Column::class);
694+
695+
try {
696+
$mock->getFilters('aSource');
697+
} catch (\Exception $exception) {
698+
$this->fail($exception->getMessage());
699+
}
700+
}
701+
680702
public function testGetData()
681703
{
682704
$mock = $this->getMockForAbstractClass(Column::class);

Tests/Grid/Column/TextColumnTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use APY\DataGridBundle\Grid\Column\Column;
66
use APY\DataGridBundle\Grid\Column\TextColumn;
77
use APY\DataGridBundle\Grid\Filter;
8-
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
8+
use PHPUnit\Framework\TestCase;
99

1010
class TextColumnTest extends TestCase
1111
{

Tests/Grid/GridTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use APY\DataGridBundle\Grid\Source\Entity;
2020
use APY\DataGridBundle\Grid\Source\Source;
2121
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
22-
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
22+
use PHPUnit\Framework\TestCase;
2323
use Symfony\Component\DependencyInjection\Container;
2424
use Symfony\Component\HttpFoundation\HeaderBag;
2525
use Symfony\Component\HttpFoundation\ParameterBag;

0 commit comments

Comments
 (0)