Exemplo n.º 1
0
 /**
  * @depends testUpdate
  */
 public function testToggleVisibility(ProductModel $product)
 {
     $expectedVisibility = !$product->getVisible();
     $event = new ProductToggleVisibilityEvent();
     $event->setProduct($product)->setDispatcher($this->getDispatcher());
     $action = new Product();
     $action->toggleVisibility($event);
     $updatedProduct = $event->getProduct();
     $this->assertEquals($expectedVisibility, $updatedProduct->getVisible());
     return $updatedProduct;
 }
Exemplo n.º 2
0
 /**
  * Toggle product visibility. No form used here
  *
  * @param ActionEvent $event
  */
 public function toggleVisibility(ProductToggleVisibilityEvent $event)
 {
     $product = $event->getProduct();
     $product->setDispatcher($event->getDispatcher())->setVisible($product->getVisible() ? false : true)->save();
     $event->setProduct($product);
 }