Example #1
0
 /**
  * Set the store Id
  *
  * @param int $storeId
  * @return array
  */
 public function getCollection($storeId)
 {
     $this->_getNotLoggedInBehavior()->setStoreId($storeId);
     return parent::getCollection($storeId);
 }
Example #2
0
 /**
  * Test getCollection None images
  * 1) Check that image attributes were not loaded
  * 2) Check no images were loaded
  * 3) Check thumbnails when no thumbnail selected
  *
  * @magentoConfigFixture default_store sitemap/product/image_include base
  */
 public function testGetCollectionBase()
 {
     $model = new Mage_Sitemap_Model_Resource_Catalog_Product();
     $products = $model->getCollection(Mage_Core_Model_App::DISTRO_STORE_ID);
     $this->_checkProductCollection($products, 3, array(1, 4, 5));
     // Check name attribute was loaded
     foreach ($products as $product) {
         $this->assertNotEmpty($product->getName(), 'name attribute was not loaded');
     }
     // Check thumbnail attribute
     $this->assertEmpty($products[1]->getImage(), 'image attribute was loaded');
     $this->assertEmpty($products[4]->getThumbnail(), 'thumbnail attribute was loaded');
     $this->assertEquals('/s/e/second_image.png', $products[4]->getImage(), 'Incorrect image attribute');
     // Check images loading
     $this->assertEmpty($products[1]->getImages(), 'Images were loaded');
     $this->assertNotEmpty($products[4]->getImages(), 'Images were not loaded');
     $this->assertEquals('Simple Images', $products[4]->getImages()->getTitle(), 'Incorrect title');
     $this->assertEquals('catalog/product/s/e/second_image.png', $products[4]->getImages()->getThumbnail(), 'Incorrect thumbnail');
     $this->assertCount(1, $products[4]->getImages()->getCollection(), 'Number of loaded images is incorrect');
     $imagesCollection = $products[4]->getImages()->getCollection();
     $this->assertEquals('catalog/product/s/e/second_image.png', $imagesCollection[0]->getUrl(), 'Incorrect image url');
     $this->assertEmpty($imagesCollection[0]->getCaption(), 'Caption not empty');
     // Check no selection
     $this->assertEmpty($products[5]->getThumbnail(), 'thumbnail is not empty');
     $this->assertEquals('no_selection', $products[5]->getImage(), 'image is incorrect');
     $this->assertEmpty($products[5]->getImages(), 'Product images were loaded');
 }