public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     $checkName = null;
     $queryParams = $request->getQueryParams();
     if (!empty($queryParams['filter']) && !empty($queryParams['label'])) {
         $checkName = sprintf('%s/%s', $queryParams['filter'], $queryParams['label']);
     }
     if ($checkName === null && !empty($request->getAttribute('filter')) && !empty($request->getAttribute('label'))) {
         $checkName = sprintf('%s/%s', $request->getAttribute('filter'), $request->getAttribute('label'));
     }
     $resultCollection = $this->runner->run($checkName);
     return $this->resultResponseFactory->createResponse($request, $resultCollection);
 }
Esempio n. 2
0
 public function testAfterRunStopTesting()
 {
     $check1 = new AlwaysSuccess();
     $check2 = new AlwaysSuccess();
     $this->runner->addCheck($check1);
     $this->runner->addCheck($check2);
     $mock = $this->getMock('ZendDiagnosticsTest\\TestAsset\\Reporter\\AbstractReporter', array('onAfterRun'));
     $mock->expects($this->atLeastOnce())->method('onAfterRun')->with($this->isInstanceOf('ZendDiagnostics\\Check\\CheckInterface'))->will($this->onConsecutiveCalls(false, true));
     $this->runner->addReporter($mock);
     $results = $this->runner->run();
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Collection', $results);
     $this->assertEquals(1, $results->count());
     $this->assertFalse($results->offsetExists($check2));
     $this->assertInstanceOf('ZendDiagnostics\\Result\\SuccessInterface', $results->offsetGet($check1));
 }
Esempio n. 3
0
 /**
  * Run all Checks and return a Result\Collection for every check.
  *
  * @param  string|null       $checkAlias An alias of Check instance to run, or null to run all checks.
  * @return ResultsCollection The result of running Checks
  */
 public function run($checkAlias = null)
 {
     $this->breakOnFailure = $this->config->getBreakOnFailure();
     $this->catchErrorSeverity = $this->config->getBreakOnFailure();
     return parent::run($checkAlias);
 }