Skip to content

Commit

Permalink
Fix DataSet test error
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Jul 27, 2015
1 parent 70181be commit 9a08b1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Data/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function bind($dataset)

foreach ($dataset as $data)
{
$this->data[] = $data;
$this[] = $data;
}

return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Data/Test/DataSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public function testOffsetExists()
* @return void
*
* @covers Windwalker\Data\DataSet::offsetGet
* @covers Windwalker\Data\DataSet::offsetSet
*/
public function testOffsetGetAndSet()
{
Expand All @@ -178,6 +179,10 @@ public function testOffsetGetAndSet()
$this->instance[3] = new Data(array('foo' => 'bar'));

$this->assertEquals('bar', $this->instance[3]->foo);

$this->instance[4] = new \stdClass;

$this->assertInstanceOf('Windwalker\Data\Data', $this->instance[4]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/DataMapper/Test/DataMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public function testGetAndSetDataClass()
$this->assertEquals('stdClass', $this->instance->getDataClass());

// If we use DataSet, all stdClass will be auto convert to Data
$this->assertInstanceOf('Windwalker\\Data\\Data', $this->instance->findOne());
$this->assertInstanceOf('Windwalker\Data\Data', $this->instance->findOne());

$this->instance->setDatasetClass('ArrayObject');

Expand Down

0 comments on commit 9a08b1c

Please sign in to comment.