/** * @covers Pants\Task\Call::__construct * @covers Pants\Task\Call::execute */ public function testRequestedTargetIsExecuted() { $this->properties->expects($this->once())->method('filter')->with('asdf')->will($this->returnArgument(0)); $target = $this->getMockBuilder('\\Pants\\Target\\Target')->disableOriginalConstructor()->getMock(); $target->expects($this->once())->method('execute')->will($this->returnSelf()); $this->targets->expects($this->once())->method('__get')->with('asdf')->will($this->returnValue($target)); $this->task->setTarget('asdf')->execute(); }
/** * @covers Pants\Target\Target::__construct * @covers Pants\Target\Target::execute */ public function testDependIsExecuted() { $target = $this->getMockBuilder('\\Pants\\Target\\Target')->disableOriginalConstructor()->getMock(); $target->expects($this->once())->method('execute')->will($this->returnSelf()); $this->targets->expects($this->once())->method('__get')->with('test')->will($this->returnValue($target)); $this->tasks->expects($this->once())->method('getIterator')->will($this->returnValue(new ArrayIterator())); $this->target->setDepends(array('test'))->execute(); }
/** * @covers Pants\Target\Targets::getDescriptions */ public function testHiddenTargetsAreNotAddedToDescriptions() { $target = $this->getMockBuilder('\\Pants\\Target\\Target')->disableOriginalConstructor()->getMock(); $target->expects($this->once())->method('getName')->will($this->returnValue('test')); $target->expects($this->once())->method('getHidden')->will($this->returnValue(true)); $target->expects($this->never())->method('getDescription'); $this->targets->add($target); $this->assertEquals(array(), $this->targets->getDescriptions()); }