Skip to content

Commit

Permalink
Merge 500f1b3 into cea089d
Browse files Browse the repository at this point in the history
  • Loading branch information
kokspflanze committed Aug 29, 2017
2 parents cea089d + 500f1b3 commit 8a88446
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

"zendframework/zend-mvc": "~2.7|~3.0",
"zendframework/zend-modulemanager": "~2.5",
"zendframework/zend-session": "~2.5",
"zendframework/zend-session": "^2.7.4",
"zendframework/zend-view": "~2.5",
"zendframework/zend-http": "~2.5",
"zendframework/zend-paginator": "~2.5",
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Get the data from an external object.
*/
class Object implements DataPopulationInterface
class DataObject implements DataPopulationInterface
{
/**
* @var ObjectAwareInterface
Expand Down
10 changes: 3 additions & 7 deletions src/ZfcDatagrid/Column/ExternalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function __construct($uniqueId = 'external')
*/
public function setDataPopulation(DataPopulation\DataPopulationInterface $dataPopulation)
{
if ($dataPopulation instanceof DataPopulation\Object && $dataPopulation->getObject() === null) {
throw new \Exception('object is missing in DataPopulation\Object!');
if ($dataPopulation instanceof DataPopulation\DataObject && $dataPopulation->getObject() === null) {
throw new \Exception('object is missing in DataPopulation\DataObject!');
}

$this->dataPopulation = $dataPopulation;
Expand All @@ -50,10 +50,6 @@ public function getDataPopulation()
*/
public function hasDataPopulation()
{
if ($this->dataPopulation !== null) {
return true;
}

return false;
return null !== $this->dataPopulation;
}
}
2 changes: 1 addition & 1 deletion src/ZfcDatagrid/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public static function isApply($currentValue, $expectedValue, $operator = self::
break;

case self::BETWEEN:
if (count($expectedValue) >= 2) {
if (is_array($expectedValue) && count($expectedValue) >= 2) {
if ($currentValue >= $expectedValue[0] && $currentValue <= $expectedValue[1]) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
namespace ZfcDatagridTest\Column\DataPopulation;

use PHPUnit\Framework\TestCase;
use ZfcDatagrid\Column\DataPopulation\Object;
use ZfcDatagrid\Column\DataPopulation\DataObject;

/**
* @group Column
* @covers \ZfcDatagrid\Column\DataPopulation\Object
* @covers \ZfcDatagrid\Column\DataPopulation\DataObject
*/
class ObjectTest extends TestCase
class DataObjectTest extends TestCase
{
public function testObject()
{
Expand All @@ -17,7 +17,7 @@ public function testObject()
->method('toString')
->will($this->returnValue('myReturn'));

$object = new Object();
$object = new DataObject();

$object->setObject($mock);
$this->assertSame($mock, $object->getObject());
Expand All @@ -33,7 +33,7 @@ public function testParameters()
->method('toString')
->will($this->returnValue('myReturn'));

$object = new Object();
$object = new DataObject();
$object->setObject($mock);

$this->assertCount(0, $object->getObjectParametersColumn());
Expand Down
6 changes: 3 additions & 3 deletions tests/ZfcDatagridTest/Column/ExternalDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function testSetGetData()
{
$col = new Column\ExternalData('myData');

$object = new DataPopulation\Object();
$object = new DataPopulation\DataObject();
$object->setObject(new DataPopulation\Object\Gravatar());
$this->assertEquals(false, $col->hasDataPopulation());

$col->setDataPopulation($object);

$this->assertEquals(true, $col->hasDataPopulation());
$this->assertInstanceOf(\ZfcDatagrid\Column\DataPopulation\Object::class, $col->getDataPopulation());
$this->assertInstanceOf(\ZfcDatagrid\Column\DataPopulation\DataObject::class, $col->getDataPopulation());
}

/**
Expand All @@ -52,7 +52,7 @@ public function testException()
{
$col = new Column\ExternalData('myData');

$object = new DataPopulation\Object();
$object = new DataPopulation\DataObject();
$col->setDataPopulation($object);
}
}
4 changes: 2 additions & 2 deletions tests/ZfcDatagridTest/PrepareDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace ZfcDatagridTest;

use PHPUnit\Framework\TestCase;
use ZfcDatagrid\Column\DataPopulation\Object;
use ZfcDatagrid\Column\DataPopulation\DataObject;
use ZfcDatagrid\Column\Type;
use ZfcDatagrid\PrepareData;

Expand Down Expand Up @@ -390,7 +390,7 @@ public function testPrepareDataPopulation()
->method('toString')
->will($this->returnValue('myReturn'));

$object = new Object();
$object = new DataObject();
$object->setObject($mock);
$object->addObjectParameterColumn('email', $this->col1);

Expand Down

0 comments on commit 8a88446

Please sign in to comment.