PhpBench\Tests\Unit\Console\Command\LogCommandTest::testHistory PHP Метод

testHistory() публичный Метод

It should show the history.
public testHistory ( )
    public function testHistory()
    {
        $input = new ArrayInput(['--no-pagination' => true], $this->command->getDefinition());
        $this->application->setTerminalDimensions(100, 10);
        $this->characterReader->read()->shouldNotBeCalled();
        $this->driver->history()->willReturn($this->history->reveal());
        $this->history->rewind()->shouldBeCalled();
        $this->history->valid()->willReturn(true, true, true, false);
        $this->history->key()->willReturn(0, 1, 2);
        $this->history->next()->shouldBeCalled();
        $this->history->current()->willReturn($this->createHistoryEntry(1), $this->createHistoryEntry(2), $this->createHistoryEntry(3));
        $this->command->execute($input, $this->output);
        $output = $this->output->fetch();
        $expected = <<<'EOT'
run 1
Date:    2016-01-01T00:00:00+02:00
Branch:  branch1
Context: foo
Scale:   10 subjects, 20 iterations, 40 revolutions
Summary: (best [mean] worst) = 0.500 [1.250] 2.000 (s)
         ⅀T: 100 μRSD/r: 0.750%

run 2
Date:    2016-01-01T00:00:00+02:00
Branch:  branch2
Context: foo
Scale:   10 subjects, 20 iterations, 40 revolutions
Summary: (best [mean] worst) = 0.500 [1.250] 2.000 (s)
         ⅀T: 100 μRSD/r: 0.750%

run 3
Date:    2016-01-01T00:00:00+01:00
Branch:  branch3
Context: foo
Scale:   10 subjects, 20 iterations, 40 revolutions
Summary: (best [mean] worst) = 0.500 [1.250] 2.000 (s)
         ⅀T: 100 μRSD/r: 0.750%


EOT;
        $this->assertEquals($this->replaceDate($expected), $this->replaceDate($output));
    }