Skip to content

Commit 661ddf8

Browse files
committed
Added failing test to prove #4019
1 parent 48ca3de commit 661ddf8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/TestCase/View/Form/EntityContextTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,26 @@ public function testValAssociated() {
465465
$this->assertNull($result);
466466
}
467467

468+
/**
469+
* Tests that trying to get values from missing associations returns null
470+
*
471+
* @return void
472+
*/
473+
public function testValMissingAssociation() {
474+
$row = new Article([
475+
'id' => 1
476+
]);
477+
$context = new EntityContext($this->request, [
478+
'entity' => $row,
479+
'table' => 'Articles',
480+
]);
481+
482+
$result = $context->val('id');
483+
$this->assertEquals($row->id, $result);
484+
485+
$this->assertNull($context->val('profile.id'));
486+
}
487+
468488
/**
469489
* Test reading values from associated entities.
470490
*

0 commit comments

Comments
 (0)