/** * Tests the form ID generation. * * @covers ::getFormId * * @dataProvider providerTestFormIds */ public function testFormId($expected, $definition) { $this->entityType->set('entity_keys', ['bundle' => $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($this->entityType)); $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()); }