25 private $productGenerator;
30 private $objectManager;
35 private $productRepository;
40 private $indexersState = [];
45 private $websiteRepository;
53 $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
54 $this->productGenerator = $this->objectManager->get(ProductGenerator::class);
55 $this->websiteRepository = $this->objectManager->get(WebsiteRepository::class);
57 $indexerListIds = $this->objectManager->get(Config::class)->getIndexers();
59 foreach ($indexerListIds as $indexerId) {
61 $this->indexersState[$indexerId[
'indexer_id']] =
$indexer->isScheduled();
73 foreach ($this->indexersState as $indexerId => $state) {
84 $name =
'Simple Product Name';
85 $sku =
'simple_product_sku';
87 $url =
'simple-product-url';
89 $secondWebsiteId = $this->websiteRepository->get(
'test')->getId();
92 'name' =>
function () use (
$name) {
95 'sku' =>
function () use ($sku) {
98 'price' =>
function () use (
$price) {
101 'url_key' =>
function () use (
$url) {
104 'category_ids' =>
function () use ($categoryId) {
107 'website_ids' =>
function () use ($secondWebsiteId) {
108 return [1, $secondWebsiteId];
111 $this->productGenerator->generate(1, $fixtureMap);
113 $product = $this->productRepository->get($sku);
118 $this->assertTrue(in_array($categoryId,
$product->getCategoryIds()));
120 $this->productRepository->delete(
$product);
static getObjectManager()
if(!isset($_GET['name'])) $name