Ejemplo n.º 1
0
 /**
  * @covers Pants\Project::execute
  */
 public function testDefaultTargetIsExecutedIfNoTargetsAreSpecified()
 {
     $target = $this->getMockBuilder('\\Pants\\Target\\Target')->setConstructorArgs(array($this->getMock('\\Pants\\Target\\Targets'), $this->getMock('\\Pants\\Property\\Properties'), $this->getMock('\\Pants\\Task\\Tasks')))->getMock();
     $target->expects($this->once())->method('execute')->will($this->returnValue($target));
     $this->project->getTasks()->expects($this->once())->method('getIterator')->will($this->returnValue(new ArrayIterator()));
     $this->project->getTargets()->expects($this->once())->method('__get')->with('default')->will($this->returnValue($target));
     $this->project->setDefault('default')->execute();
 }
Ejemplo n.º 2
0
 /**
  * Handle the XML project
  *
  * @return Project
  */
 public function handleProject()
 {
     $project = new Project();
     $project->setDefault($this->xmlReader->getAttribute("default"));
     while ($this->xmlReader->read()) {
         if ($this->xmlReader->name == "project" && $this->xmlReader->nodeType == XMLReader::END_ELEMENT) {
             return $project;
         } elseif ($this->xmlReader->name == "target" && $this->xmlReader->nodeType == XMLReader::ELEMENT) {
             $project->getTargets()->add($this->handleTarget());
         } elseif ($this->xmlReader->nodeType == XMLReader::ELEMENT) {
             $project->getTasks()->add($this->handleTask());
         }
     }
 }