public function TransactionAdminTest::doTestSetTransactionTypeFieldCreation in Transaction 8
Tests field creation from the transaction type edit.
See also
\Drupal\transaction\Form\TransactionTypeEditForm
1 call to TransactionAdminTest::doTestSetTransactionTypeFieldCreation()
- TransactionAdminTest::testAdmin in tests/
src/ Functional/ TransactionAdminTest.php - Full admin test sequence.
File
- tests/
src/ Functional/ TransactionAdminTest.php, line 102
Class
- TransactionAdminTest
- Tests the transaction administration.
Namespace
Drupal\Tests\transaction\FunctionalCode
public function doTestSetTransactionTypeFieldCreation() {
$post = [
'log_message' => '_create',
'log_message_field_name' => 'log_message',
'last_transaction' => '_create',
'last_transaction_label' => 'Last transaction',
'last_transaction_field_name' => 'last_transaction',
];
$this
->drupalPostForm('admin/config/workflow/transaction/edit/generic_workflow', $post, 'Save transaction type');
// Check the log message field was created on the transaction type.
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */
$entity_field_manager = \Drupal::service('entity_field.manager');
$fields = $entity_field_manager
->getFieldDefinitions('transaction', 'generic_workflow');
$this
->assertTrue(isset($fields['field_log_message']));
$fields = $entity_field_manager
->getFieldDefinitions('entity_test', 'basic');
$this
->assertTrue(isset($fields['field_last_transaction']));
}