I try to check my form. I read that:
But I get an exception null
class MediaTypeTest extends TypeTestCase
{
protected function setUp()
{
}
protected function tearDown()
{
}
public function testMe()
{
$formData = array(
'test' => 'test',
'test2' => 'test2',
);
$form = $this->factory->create(MediaType::class);
$form->submit($formData);
$this->assertTrue($form->isSynchronized());
$this->assertEquals(new Media(), $form->getData());
$view = $form->createView();
$children = $view->children;
foreach (array_keys($formData) as $key) {
$this->assertArrayHasKey($key, $children);
}
}
}
I understand that the string buggy is:
$ form = $ this → factory → create (MediaType :: class);
But how can I decide?
I run:
phpunit tests / unit / Form / MediaTypeTest.php
Or using the code:
php vendor / bin / codecept unit Form / MediaTypeTest.php
Any idea?
source
share