Skip to content
Permalink
Browse files

Write testFieldNames() method for test fieldNames() method of View/He…

…lper/FormContent.php
  • Loading branch information...
sohelrana820 committed Mar 16, 2018
1 parent 812ac18 commit af6d7f8244ba53c69f9a8d78e516103d7f8e1015
Showing with 27 additions and 0 deletions.
  1. +27 −0 tests/TestCase/View/Form/FormContextTest.php
@@ -173,6 +173,33 @@ public function testType()
$this->assertNull($context->type('Prefix.email'));
}
/**
* Test the fieldNames method.
*
* @return void
*/
public function testFieldNames()
{
$form = new Form();
$context = new FormContext($this->request, [
'entity' => $form
]);
$expected = [];
$result = $context->fieldNames();
$this->assertEquals($expected, $result);
$form->schema()
->addField('email', 'string')
->addField('password', 'string');
$context = new FormContext($this->request, [
'entity' => $form
]);
$expected = ['email', 'password'];
$result = $context->fieldNames();
$this->assertEquals($expected, $result);
}
/**
* Test fetching attributes.
*

0 comments on commit af6d7f8

Please sign in to comment.
You can’t perform that action at this time.