Skip to content

Commit

Permalink
Added failing test to prove #4019
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jul 19, 2014
1 parent 48ca3de commit 661ddf8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/TestCase/View/Form/EntityContextTest.php
Expand Up @@ -465,6 +465,26 @@ public function testValAssociated() {
$this->assertNull($result);
}

/**
* Tests that trying to get values from missing associations returns null
*
* @return void
*/
public function testValMissingAssociation() {
$row = new Article([
'id' => 1
]);
$context = new EntityContext($this->request, [
'entity' => $row,
'table' => 'Articles',
]);

$result = $context->val('id');
$this->assertEquals($row->id, $result);

$this->assertNull($context->val('profile.id'));
}

/**
* Test reading values from associated entities.
*
Expand Down

0 comments on commit 661ddf8

Please sign in to comment.