ProductNoStoreTest.php in Commerce Core 8.2
File
modules/product/tests/src/Functional/ProductNoStoreTest.php
View source
<?php
namespace Drupal\Tests\commerce_product\Functional;
use Drupal\Core\Url;
use Drupal\Tests\commerce\Functional\CommerceBrowserTestBase;
class ProductNoStoreTest extends CommerceBrowserTestBase {
public static $modules = [
'commerce_product',
];
protected function getAdministratorPermissions() {
return array_merge([
'administer commerce_product',
'administer commerce_product_type',
'access commerce_product overview',
], parent::getAdministratorPermissions());
}
public function testCreateProduct() {
$this->store
->delete();
$this
->drupalGet('admin/commerce/products');
$this
->clickLink('Add product');
$session = $this
->assertSession();
$session
->pageTextContains("Products can't be created until a store has been added.");
$session
->linkExists('Add a new store.');
$session
->linkByHrefExists(Url::fromRoute('entity.commerce_store.add_page')
->toString());
}
}