Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\Framework;
11
 
12
use function explode;
13
use PHPUnit\Util\Test as TestUtil;
14
 
15
/**
16
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
17
 */
18
final class DataProviderTestSuite extends TestSuite
19
{
20
    /**
21
     * @var list<ExecutionOrderDependency>
22
     */
23
    private $dependencies = [];
24
 
25
    /**
26
     * @param list<ExecutionOrderDependency> $dependencies
27
     */
28
    public function setDependencies(array $dependencies): void
29
    {
30
        $this->dependencies = $dependencies;
31
 
32
        foreach ($this->tests as $test) {
33
            if (!$test instanceof TestCase) {
34
                // @codeCoverageIgnoreStart
35
                continue;
36
                // @codeCoverageIgnoreStart
37
            }
38
            $test->setDependencies($dependencies);
39
        }
40
    }
41
 
42
    /**
43
     * @return list<ExecutionOrderDependency>
44
     */
45
    public function provides(): array
46
    {
47
        if ($this->providedTests === null) {
48
            $this->providedTests = [new ExecutionOrderDependency($this->getName())];
49
        }
50
 
51
        return $this->providedTests;
52
    }
53
 
54
    /**
55
     * @return list<ExecutionOrderDependency>
56
     */
57
    public function requires(): array
58
    {
59
        // A DataProviderTestSuite does not have to traverse its child tests
60
        // as these are inherited and cannot reference dataProvider rows directly
61
        return $this->dependencies;
62
    }
63
 
64
    /**
65
     * Returns the size of the each test created using the data provider(s).
66
     *
67
     * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
68
     */
69
    public function getSize(): int
70
    {
71
        [$className, $methodName] = explode('::', $this->getName());
72
 
73
        return TestUtil::getSize($className, $methodName);
74
    }
75
}