Beispiel #1
0
 public function testUpdateAllOffers()
 {
     $this->markTestIncomplete("Fails");
     $products = array();
     $productsCnt = mt_rand(1, 20);
     for ($i = 0; $i < $productsCnt; $i++) {
         $productMock = $this->mockModel('catalog/product', array('getStoreIds'), false);
         $productMock->expects($this->any())->method('getStoreIds')->will($this->returnValue(array(1)));
         $products[] = $productMock;
     }
     $collectionMock = $this->mockResource('catalog/product_collection', array('getIterator'));
     $collectionMock->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($products)));
     $helperMock = $this->mockHelper('xcom_xfabric', array('send'));
     $helperMock->expects($this->exactly($productsCnt))->method('send')->with($this->equalTo('com.x.webstore.v1/WebStoreOfferUpdate/WebStoreOfferUpdated'), $this->anything());
     $retObj = $this->_object->updateAllOffers();
     $this->assertSame($this->_object, $retObj);
 }
Beispiel #2
0
 /**
  * Execute Mass Offer Update Cron Job
  * <p>Steps:</p>
  * <p>Execute Mass Offer Update Cron Job</p>
  * <p>Expected result:</p>
  * <p>WebStoreOfferUpdated Messages has been sent out for each product.</p>
  *
  * @test
  */
 public function executeMassOfferUpdateCronJob()
 {
     //Action
     $observer = new Xcom_Chronicle_Model_Observer();
     $observer->massOfferUpdateCronJob(null);
     $products = $this->_getProducts();
     $expectedMsgs = array();
     /* @var $product Mage_Catalog_Model_Product  */
     foreach ($products as $product) {
         $storeCount = count($product->getStoreIds());
         while ($storeCount-- > 0) {
             $expectedMsgs[] = array("topic" => WebStore::OFFER_UPDATED);
         }
     }
     $msgs = $this->_get2dXMessages();
     //Verify
     $this->verifyXMessage($expectedMsgs, $msgs);
 }