コード例 #1
0
ファイル: TestRunnerTest.php プロジェクト: phpassert/core
 function testMustCallReport()
 {
     $results = [new Result('')];
     $test = $this->getMock(Test::class);
     $test->expects($this->once())->method('execute')->willReturn($results);
     $discoverer = $this->getMock(Discoverer::class);
     $discoverer->expects($this->once())->method('findTests')->willReturn([$test]);
     $reporter = $this->getMock(Reporter::class);
     $reporter->expects($this->once())->method('report')->with($results);
     $runner = new Runner($discoverer, $reporter);
     $runner->run();
 }
コード例 #2
0
ファイル: TestCommand.php プロジェクト: phpassert/phpassert
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $bootstrap = $input->getOption('bootstrap');
     if ($bootstrap) {
         require_once $this->toAbsolutePath($bootstrap);
     }
     $path = $input->getArgument('path') ?? 'tests';
     $runner = new Runner(new FSDiscoverer($this->toAbsolutePath($path)), new ConsoleReporter($output));
     $results = $runner->run();
     $failed = array_filter($results, function (Result $result) {
         return !$result->isSuccess();
     });
     return intval(count($failed) > 0);
 }
コード例 #3
0
ファイル: run_examples.php プロジェクト: phpassert/core
<?php

require_once 'bootstrap.php';
use Symfony\Component\Console\Output\ConsoleOutput;
use PHPAssert\Core\Discoverer\FSDiscoverer;
use PHPAssert\Core\Reporter\ConsoleReporter;
use PHPAssert\Core\Runner\Runner;
$discoverer = new FSDiscoverer(__DIR__ . DIRECTORY_SEPARATOR . 'examples');
$reporter = new ConsoleReporter(new ConsoleOutput());
$runner = new Runner($discoverer, $reporter);
$runner->run();