Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / phpunit / phpunit / src / Runner / Filter / Group.php
1 <?php
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
11 /**
12  * @since Class available since Release 4.0.0
13  */
14 abstract class PHPUnit_Runner_Filter_GroupFilterIterator extends RecursiveFilterIterator
15 {
16     /**
17      * @var array
18      */
19     protected $groupTests = array();
20
21     /**
22      * @param RecursiveIterator           $iterator
23      * @param array                       $groups
24      * @param PHPUnit_Framework_TestSuite $suite
25      */
26     public function __construct(RecursiveIterator $iterator, array $groups, PHPUnit_Framework_TestSuite $suite)
27     {
28         parent::__construct($iterator);
29
30         foreach ($suite->getGroupDetails() as $group => $tests) {
31             if (in_array($group, $groups)) {
32                 $testHashes = array_map(
33                     function ($test) {
34                         return spl_object_hash($test);
35                     },
36                     $tests
37                 );
38
39                 $this->groupTests = array_merge($this->groupTests, $testHashes);
40             }
41         }
42     }
43
44     /**
45      * @return bool
46      */
47     public function accept()
48     {
49         $test = $this->getInnerIterator()->current();
50
51         if ($test instanceof PHPUnit_Framework_TestSuite) {
52             return true;
53         }
54
55         return $this->doAccept(spl_object_hash($test));
56     }
57
58     abstract protected function doAccept($hash);
59 }