Skip to content

Commit

Permalink
Write testFieldNames() method for test fieldNames() method of View/He…
Browse files Browse the repository at this point in the history
…lper/FormContent.php
  • Loading branch information
sohelrana820 committed Mar 16, 2018
1 parent 812ac18 commit af6d7f8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/TestCase/View/Form/FormContextTest.php
Expand Up @@ -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.
*
Expand Down

0 comments on commit af6d7f8

Please sign in to comment.