Exemplo n.º 1
0
 /**
  * Test get/set item.
  */
 public function testItem()
 {
     $type = new Type();
     $this->assertNull($type->getItem());
     /* @var $item \PHPUnit_Framework_MockObject_MockObject|Item */
     $item = $this->getMock('\\AnimeDb\\Bundle\\CatalogBundle\\Entity\\Widget\\Item');
     $item->expects($this->once())->method('setType')->with($type)->will($this->returnSelf());
     $this->assertEquals($type, $type->setItem($item));
     $this->assertEquals($type, $type->setItem($item));
     $this->assertEquals($item, $type->getItem());
 }
Exemplo n.º 2
0
 /**
  * Set type.
  *
  * @param Type $type
  *
  * @return Item
  */
 public function setType(Type $type)
 {
     if ($this->type !== $type) {
         $this->type = $type;
         $type->setItem($this);
     }
     return $this;
 }