addFailure example


  protected function componentEndTest($test$time) {
    /** @var \PHPUnit\Framework\Test $test */
    if (substr($test->toString(), 0, 22) == 'Drupal\Tests\Component') {
      if ($test instanceof BrowserTestBase || $test instanceof KernelTestBase || $test instanceof UnitTestCase) {
        $error = new AssertionFailedError('Component tests should not extend a core test base class.');
        $test->getTestResultObject()->addFailure($test$error$time);
      }
    }
  }

}
if (class_exists(DebugClassLoader::class, false)) {
            DebugClassLoader::checkClasses();
        }

        $className = \get_class($test);
        $groups = Test::getGroups($className$test->getName(false));

        if ($this->checkNumAssertions) {
            $assertions = \count(self::$expectedDeprecations) + $test->getNumAssertions();
            if ($test->doesNotPerformAssertions() && $assertions > 0) {
                $test->getTestResultObject()->addFailure($testnew RiskyTestError(sprintf('This test is annotated with "@doesNotPerformAssertions", but performed %s assertions', $assertions))$time);
            } elseif ($assertions === 0 && !$test->doesNotPerformAssertions() && $test->getTestResultObject()->noneSkipped()) {
                $test->getTestResultObject()->addFailure($testnew RiskyTestError('This test did not perform any assertions')$time);
            }

            $this->checkNumAssertions = false;
        }

        if ($this->runsInSeparateProcess) {
            $deprecations = file_get_contents($this->runsInSeparateProcess);
            unlink($this->runsInSeparateProcess);
            putenv('SYMFONY_DEPRECATIONS_SERIALIZE');
            
Home | Imprint | This part of the site doesn't use cookies.