20 const BASE_IMAGE_PATH =
'http://localhost/pub/media/catalog/product/cache/8d4d2075b1a30681853bef5bdc41b164';
40 $this->assertEmpty(
$product->getName(),
'Attribute name is not empty');
41 $this->assertEmpty(
$product->getImage(),
'Attribute image is not empty');
42 $this->assertEmpty(
$product->getThumbnail(),
'Attribute thumbnail is not empty');
45 $this->assertEmpty(
$products[4]->getImages(),
'Images were loaded');
67 $this->assertNotEmpty(
$product->getName(),
'name attribute was not loaded');
71 $this->assertEmpty(
$products[1]->getThumbnail(),
'Thumbnail attribute was loaded');
72 $this->assertEmpty(
$products[4]->getImage(),
'Image attribute was loaded');
73 $this->assertEquals(
'/m/a/magento_image_sitemap.png',
$products[4]->getThumbnail(),
'Incorrect thumbnail');
76 $this->assertEmpty(
$products[1]->getImages(),
'Images were loaded');
77 $this->assertNotEmpty(
$products[4]->getImages(),
'Images were not loaded');
78 $this->assertEquals(
'Simple Images',
$products[4]->getImages()->getTitle(),
'Incorrect title');
80 self::BASE_IMAGE_PATH.
'/m/a/magento_image_sitemap.png',
81 $products[4]->getImages()->getThumbnail(),
84 $this->assertCount(2,
$products[4]->getImages()->getCollection(),
'Not all images were loaded');
86 $imagesCollection =
$products[4]->getImages()->getCollection();
88 self::BASE_IMAGE_PATH.
'/m/a/magento_image_sitemap.png',
89 $imagesCollection[0]->getUrl(),
93 self::BASE_IMAGE_PATH.
'/s/e/second_image.png',
94 $imagesCollection[1]->getUrl(),
97 $this->assertEmpty($imagesCollection[0]->getCaption(),
'Caption not empty');
100 $this->assertEmpty(
$products[5]->getImage(),
'image is not empty');
101 $this->assertEquals(
'no_selection',
$products[5]->getThumbnail(),
'thumbnail is incorrect');
102 $imagesCollection =
$products[5]->getImages()->getCollection();
103 $this->assertCount(1, $imagesCollection);
105 self::BASE_IMAGE_PATH.
'/s/e/second_image_1.png',
106 $imagesCollection[0]->getUrl(),
107 'Image url is incorrect' 110 self::BASE_IMAGE_PATH.
'/s/e/second_image_1.png',
111 $products[5]->getImages()->getThumbnail(),
112 'Product thumbnail is incorrect' 135 $this->assertNotEmpty(
$product->getName(),
'name attribute was not loaded');
139 $this->assertEmpty(
$products[1]->getImage(),
'image attribute was loaded');
140 $this->assertEmpty(
$products[4]->getThumbnail(),
'thumbnail attribute was loaded');
141 $this->assertEquals(
'/s/e/second_image.png',
$products[4]->getImage(),
'Incorrect image attribute');
144 $this->assertEmpty(
$products[1]->getImages(),
'Images were loaded');
145 $this->assertNotEmpty(
$products[4]->getImages(),
'Images were not loaded');
146 $this->assertEquals(
'Simple Images',
$products[4]->getImages()->getTitle(),
'Incorrect title');
148 self::BASE_IMAGE_PATH.
'/s/e/second_image.png',
149 $products[4]->getImages()->getThumbnail(),
150 'Incorrect thumbnail' 152 $this->assertCount(1,
$products[4]->getImages()->getCollection(),
'Number of loaded images is incorrect');
154 $imagesCollection =
$products[4]->getImages()->getCollection();
156 self::BASE_IMAGE_PATH.
'/s/e/second_image.png',
157 $imagesCollection[0]->getUrl(),
158 'Incorrect image url' 160 $this->assertEmpty($imagesCollection[0]->getCaption(),
'Caption not empty');
163 $this->assertEmpty(
$products[5]->getThumbnail(),
'thumbnail is not empty');
164 $this->assertEquals(
'no_selection',
$products[5]->getImage(),
'image is incorrect');
165 $this->assertEmpty(
$products[5]->getImages(),
'Product images were loaded');
180 $this->assertCount($expectedCount,
$products,
'Number of loaded products is incorrect');
181 foreach ($expectedKeys as $expectedKey) {
182 $this->assertArrayHasKey($expectedKey,
$products);
187 $this->assertNotEmpty(
$product->getUpdatedAt());
188 $this->assertNotEmpty(
$product->getId());
189 $this->assertNotEmpty(
$product->getUrl());
_checkProductCollection(array $products, $expectedCount, array $expectedKeys)
static getObjectManager()