protected function PrepopulateFieldTest::assertPrepopulate in Prepopulate 8.2
Assert all values are prepopulated as expected.
Parameters
array $query: The prepopulated query strings.
string $expected: The expected results populated in the node.
Throws
\Behat\Mink\Exception\ResponseTextException
1 call to PrepopulateFieldTest::assertPrepopulate()
- PrepopulateFieldTest::testFieldsPrepopulate in tests/
src/ Functional/ PrepopulateFieldTest.php - Test pre-populating fields.
File
- tests/
src/ Functional/ PrepopulateFieldTest.php, line 105
Class
- PrepopulateFieldTest
- Field functionality tests of prepopulate.
Namespace
Drupal\Tests\prepopulate\FunctionalCode
protected function assertPrepopulate(array $query, $expected) {
// Title is required.
$query[] = 'edit[title][widget][0][value]=simple title';
// IEF taxonomy 'name' field is required.
$query[] = 'edit[field_ief][widget][0][inline_entity_form][name][widget][0][value]=Apples';
$this
->drupalGet(Url::fromUri('internal:/node/add/test_content?' . implode('&', $query)));
$this
->drupalPostForm(NULL, [], 'Save');
$this
->assertSession()
->pageTextContains('Test Content simple title has been created.');
$this
->assertSession()
->pageTextContains($expected);
$this
->assertSession()
->pageTextContains('IEF Apples');
}