/** * Tests the add page for an entity type not using bundle entities. */ public function testAddPageWithoutBundleEntities() { entity_test_create_bundle('test', 'Test label', 'entity_test_mul'); // Delete the default bundle, so that we can rely on our own. entity_test_delete_bundle('entity_test_mul', 'entity_test_mul'); // One bundle exists, confirm redirection to the add-form. $this->drupalGet('/entity_test_mul/add'); $this->assertUrl('/entity_test_mul/add/test'); // Two bundles exist, confirm both are shown. entity_test_create_bundle('test2', 'Test2 label', 'entity_test_mul'); $this->drupalGet('/entity_test_mul/add'); $this->assertLink('Test label'); $this->assertLink('Test2 label'); $this->clickLink('Test2 label'); $this->drupalGet('/entity_test_mul/add/test2'); $this->drupalPostForm(NULL, ['name[0][value]' => 'test name'], t('Save')); $entity = EntityTestMul::load(1); $this->assertEqual('test name', $entity->label()); }