getTestResultObject example

->save();

    // The installation profile is provided by a container parameter. Saving     // the configuration doesn't automatically trigger invalidation     $this->container->get('kernel')->rebuildContainer();
  }

  /** * Stops test execution. */
  protected function stop() {
    $this->getTestResultObject()->stop();
  }

  /** * Dumps the current state of the virtual filesystem to STDOUT. */
  protected function vfsDump() {
    vfsStream::inspect(new vfsStreamPrintVisitor());
  }

  /** * Returns the modules to enable for this test. * * @param string $class * The fully-qualified class name of this test. * * @return array */
if (!$this->runsInSeparateProcess) {
                if (\in_array('time-sensitive', $groups, true)) {
                    ClockMock::register(\get_class($test));
                    ClockMock::withClockMock(true);
                }
                if (\in_array('dns-sensitive', $groups, true)) {
                    DnsMock::register(\get_class($test));
                }
            }

            if (!$test->getTestResultObject()) {
                return;
            }

            $annotations = Test::parseTestMethodAnnotations(\get_class($test)$test->getName(false));

            if (isset($annotations['class']['expectedDeprecation'])) {
                $test->getTestResultObject()->addError($testnew AssertionFailedError('"@expectedDeprecation" annotations are not allowed at the class level.'), 0);
            }
            if (isset($annotations['method']['expectedDeprecation']) || $this->checkNumAssertions = method_exists($test, 'expectDeprecation') && (new \ReflectionMethod($test, 'expectDeprecation'))->getFileName() === (new \ReflectionMethod(ExpectDeprecationTrait::class, 'expectDeprecation'))->getFileName()) {
                if (isset($annotations['method']['expectedDeprecation'])) {
                    self::$expectedDeprecations = $annotations['method']['expectedDeprecation'];
                    
$ignoredAnnotations = ['covers', 'coversDefaultClass', 'coversNothing'];

        foreach ($ignoredAnnotations as $annotation) {
            if (isset($annotations['class'][$annotation]) || isset($annotations['method'][$annotation])) {
                return;
            }
        }

        $sutFqcn = ($this->sutFqcnResolver)($test);
        if (!$sutFqcn) {
            if ($this->warningOnSutNotFound) {
                $test->getTestResultObject()->addWarning($testnew Warning('Could not find the tested class.'), 0);
            }

            return;
        }

        $covers = $sutFqcn;
        if (!\is_array($sutFqcn)) {
            $covers = [$sutFqcn];
            while ($parent = get_parent_class($sutFqcn)) {
                $covers[] = $parent;
                $sutFqcn = $parent;
            }

  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);
      }
    }
  }

}

trait ExpectDeprecationTraitBeforeV8_4
{
    /** * @param string $message */
    protected function expectDeprecation($message): void
    {
        // Expected deprecations set by isolated tests need to be written to a file         // so that the test running process can take account of them.         if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
            $this->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
            $expectedDeprecations = file_get_contents($file);
            if ($expectedDeprecations) {
                $expectedDeprecations = array_merge(unserialize($expectedDeprecations)[$message]);
            } else {
                $expectedDeprecations = [$message];
            }
            file_put_contents($fileserialize($expectedDeprecations));

            return;
        }

        

    public function expectDeprecation(): void
    {
        if (1 > \func_num_args() || !\is_string($message = func_get_arg(0))) {
            throw new \InvalidArgumentException(sprintf('The "%s()" method requires the string $message argument.', __FUNCTION__));
        }

        // Expected deprecations set by isolated tests need to be written to a file         // so that the test running process can take account of them.         if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
            $this->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
            $expectedDeprecations = file_get_contents($file);
            if ($expectedDeprecations) {
                $expectedDeprecations = array_merge(unserialize($expectedDeprecations)[$message]);
            } else {
                $expectedDeprecations = [$message];
            }
            file_put_contents($fileserialize($expectedDeprecations));

            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.