コード例 #1
0
 /**
  * @param Varien_Controller_Action
  * @param Mage_Catalog_Model_Product
  */
 function doBindWheelSide($controller, Elite_Vaf_Model_Catalog_Product $product)
 {
     $VFproduct = new VF_Product();
     $VFproduct->setId($product->getId());
     $wheeladapterProduct = new VF_Wheeladapter_Catalog_Product($VFproduct);
     $pattern = $controller->getRequest()->getParam('wheel_side_pattern');
     if (!$pattern) {
         return $wheeladapterProduct->unsetWheelSideBoltPattern();
     }
     $boltPattern = VF_Wheel_BoltPattern::create($pattern);
     $wheeladapterProduct->setWheelSideBoltPattern($boltPattern);
 }
コード例 #2
0
 function testUnbindBoltFromProduct()
 {
     $this->setRequestParams(array('wheel_side_pattern' => '4x114.3'));
     $binder = new Elite_Vafwheeladapter_Observer_WheelSideBinder();
     $product = new Elite_Vaf_Model_Catalog_Product();
     $product->setId(1);
     $event = $this->event($product);
     $binder->bindWheelSide($event);
     $this->setRequestParams(array('wheel_side_pattern' => ''));
     $binder = new Elite_Vafwheeladapter_Observer_WheelSideBinder();
     $product = new Elite_Vaf_Model_Catalog_Product();
     $product->setId(1);
     $event = $this->event($product);
     $binder->bindWheelSide($event);
     $VFproduct = new VF_Product();
     $VFproduct->setId($product->getId());
     $wheeladapterProduct = new VF_Wheeladapter_Catalog_Product($VFproduct);
     $this->assertFalse($wheeladapterProduct->getWheelSideBoltPattern(), 'should unbind bolt pattern from product');
 }
コード例 #3
0
ファイル: ProductTest.php プロジェクト: vehiclefits/library
 function testCreateNewProduct2()
 {
     $product = new VF_Product();
     $wheelAdapterProduct = new VF_Wheeladapter_Catalog_Product($product);
     $this->assertEquals(array(), $wheelAdapterProduct->getVehicleSideBoltPatterns(), 'should create new product w/ no bolt patterns');
 }