public function EntityFormTest::testFormId in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testFormId()
Tests the form ID generation.
@covers ::getFormId
@dataProvider providerTestFormIds
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFormTest.php, line 43 - Contains \Drupal\Tests\Core\Entity\EntityFormTest.
Class
- EntityFormTest
- @coversDefaultClass \Drupal\Core\Entity\EntityForm @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testFormId($expected, $definition) {
$entity_type = $this
->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
$entity_type
->expects($this
->any())
->method('hasKey')
->with('bundle')
->will($this
->returnValue($definition['bundle']));
$entity = $this
->getMockForAbstractClass('Drupal\\Core\\Entity\\Entity', array(
array(),
$definition['entity_type'],
), '', TRUE, TRUE, TRUE, array(
'getEntityType',
'bundle',
));
$entity
->expects($this
->any())
->method('getEntityType')
->will($this
->returnValue($entity_type));
$entity
->expects($this
->any())
->method('bundle')
->will($this
->returnValue($definition['bundle']));
$this->entityForm
->setEntity($entity);
$this->entityForm
->setOperation($definition['operation']);
$this
->assertSame($expected, $this->entityForm
->getFormId());
}