Permalink
Browse files

add a test to make sure the product ValidationOptions is called

  • Loading branch information...
1 parent 232b980 commit 23d548379df211c23641358bc8a196ac7d122e37 @iampersistent iampersistent committed Jul 15, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/Entity/Order/ItemTest.php
@@ -10,6 +10,10 @@ public function testOptionMethods()
{
$item = new Item();
+ $rmSetProduct = new \ReflectionMethod($item, 'setProduct');
+ $rmSetProduct->setAccessible(true);
+ $rmSetProduct->invokeArgs($item, array($this->createProductOptionValidate()));
+
$this->assertNull($item->getOption('noOption'));
$rmAddOption = new \ReflectionMethod($item, 'addOption');
@@ -59,4 +63,14 @@ public function testOptionMethods()
$rmClearOptions->invoke($item);
$this->assertEmpty($item->getOptions());
}
+
+ protected function createProductOptionValidate()
+ {
+ $product = $this->getMock('Vespolina\Entity\Product');
+ $product->expects($this->atLeastOnce())
+ ->method('validateOption')
+ ->will($this->returnValue(true));
+
+ return $product;
+ }
}

0 comments on commit 23d5483

Please sign in to comment.