public function DeveloperAppUITest::testAppCrudMultipleProductsAdd in Apigee Edge 8
Creates an app with no products and then adds multiple ones.
File
- tests/
src/ Functional/ DeveloperAppUITest.php, line 420
Class
- DeveloperAppUITest
- Developer app UI tests.
Namespace
Drupal\Tests\apigee_edge\FunctionalCode
public function testAppCrudMultipleProductsAdd() {
$this
->submitAdminForm([]);
$this->products[] = $this
->createProduct();
$this->products[] = $this
->createProduct();
$this
->assertAppCrud(function (array $data) : array {
$data["api_products[{$this->products[2]->getName()}]"] = $this->products[2]
->getName();
return $data;
}, function () {
$this
->assertSession()
->pageTextNotContains($this->products[0]
->label());
$this
->assertSession()
->pageTextNotContains($this->products[1]
->label());
$this
->assertSession()
->pageTextContains($this->products[2]
->label());
}, function (array $data, string $credential_id) : array {
$data["credential[{$credential_id}][api_products][{$this->products[0]->getName()}]"] = $this->products[0]
->getName();
$data["credential[{$credential_id}][api_products][{$this->products[1]->getName()}]"] = $this->products[1]
->getName();
$data["credential[{$credential_id}][api_products][{$this->products[2]->getName()}]"] = "";
return $data;
}, function () {
$this
->assertSession()
->pageTextContains($this->products[0]
->label());
$this
->assertSession()
->pageTextContains($this->products[1]
->label());
$this
->assertSession()
->pageTextNotContains($this->products[2]
->label());
});
}