terminate() public method

public terminate ( Hal\Component\Result\ResultCollection $collection, Hal\Component\Result\ResultCollection $groupedResults )
$collection Hal\Component\Result\ResultCollection
$groupedResults Hal\Component\Result\ResultCollection
Exemplo n.º 1
0
 /**
  * @dataProvider validSecondsToTimeString
  */
 public function testFormaterReturnsCorrectDurationForUnderstanding($duration, $expectedString)
 {
     $collection = $this->getMockBuilder('\\Hal\\Component\\Result\\ResultCollection')->disableOriginalConstructor()->getMock();
     $collection->expects($this->any())->method('asArray')->will($this->returnValue([['time' => $duration]]));
     $validator = $this->getMockBuilder('\\Hal\\Application\\Rule\\Validator')->disableOriginalConstructor()->getMock();
     $bounds = new Bounds();
     $formater = new Cli($validator, $bounds, $this->getMockBuilder('\\Hal\\Application\\Extension\\ExtensionService')->disableOriginalConstructor()->getMock());
     $groupedResults = new ResultCollection();
     $output = $formater->terminate($collection, $groupedResults);
     $this->assertContains($expectedString, $output);
 }
Exemplo n.º 2
0
 public function testFormaterReturnsHtml()
 {
     $rs1 = $this->getMockBuilder('\\Hal\\Component\\Result\\ResultSet')->disableOriginalConstructor()->getMock();
     $rs1->expects($this->any())->method('asArray')->will($this->returnValue(array('volume' => 5)));
     $rs2 = $this->getMockBuilder('\\Hal\\Component\\Result\\ResultSet')->disableOriginalConstructor()->getMock();
     $rs2->expects($this->any())->method('asArray')->will($this->returnValue(array('volume' => 15)));
     $collection = $this->getMockBuilder('\\Hal\\Component\\Result\\ResultCollection')->disableOriginalConstructor()->getMock();
     $collection->expects($this->any())->method('getIterator')->will($this->returnValue(new \ArrayIterator(array($rs1, $rs2))));
     $collection->expects($this->any())->method('asArray')->will($this->returnValue(array(array('volume' => 5), array('volume' => 10))));
     $collection->expects($this->any())->method('getFilename')->will($this->returnValue('abc'));
     $validator = $this->getMockBuilder('\\Hal\\Application\\Rule\\Validator')->disableOriginalConstructor()->getMock();
     $bounds = new Bounds();
     $formater = new Cli($validator, $bounds);
     $groupedResults = new ResultCollection();
     $output = $formater->terminate($collection, $groupedResults);
     $this->assertRegExp('/Maintainability/', $output);
 }