Skip to content

Commit

Permalink
Unit testing Entity after adding the source() method
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 16, 2014
1 parent cd2c272 commit 24b28af
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions tests/TestCase/ORM/EntityTest.php
Expand Up @@ -1005,16 +1005,39 @@ public function testDebugInfo() {
$entity = new Entity(['foo' => 'bar'], ['markClean' => true]);
$entity->accessible('name', true);
$entity->virtualProperties(['baz']);
$entity->dirty('foo', true);
$entity->errors('foo', ['An error']);
$entity->source([
'alias' => 'foos',
'className' => 'Something'
]);
$result = $entity->__debugInfo();
$expected = [
'new' => true,
'accessible' => ['name'],
'new' => null,
'accessible' => ['name' => true],
'properties' => ['foo' => 'bar'],
'dirty' => ['foo' => true],
'virtual' => ['baz'],
'errors' => ['foo' => ['An error']]
'errors' => ['foo' => ['An error']],
'repository' => [
'alias' => 'foos',
'className' => 'Something'
]
];
$this->assertSame($expected, $result);
}

/**
* Tests the source method
*
* @return void
*/
public function testSource() {
$entity = new Entity;
$this->assertEquals([], $entity->source());
$source = ['alias' => 'foo', 'className' => 'bar'];
$entity->source($source);
$this->assertEquals($source, $entity->source());
}

}

0 comments on commit 24b28af

Please sign in to comment.