Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nrother committed Feb 17, 2017
1 parent f4b9075 commit 506852e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/TestCase/View/Form/EntityContextTest.php
Expand Up @@ -447,6 +447,21 @@ public function testValBasic()
$this->assertNull($result);
}

/**
* Test default values when entity is an array.
*
* @return void
*/
public function testValDefaultArray()
{
$context = new EntityContext($this->request, [
'entity' => ['title' => 'foo'],
'table' => 'Articles',
]);
$this->assertEquals('foo', $context->val('title', ['default' => 'bar']));
$this->assertEquals('bar', $context->val('nottitle', ['default' => 'bar']));
}

/**
* Test reading array values from an entity.
*
Expand Down

0 comments on commit 506852e

Please sign in to comment.