private function sortTestSuite(TestSuite $suite) { $tests = $suite->tests(); $testsOrderResult = array(static::SORT_NONE, null); foreach ($tests as $test) { if ($test instanceof TestCase && Util::getInvisibleProperty($test, 'dependencies', 'hasDependencies')) { return $testsOrderResult; } } $orderedTests = new SegmentedQueue($tests); $orderedTests->setMergeMode($this->mergeMode); foreach ($tests as $position => $test) { list($testOrderResult, $time) = $this->sortTest($test, $position, $orderedTests); if ($testsOrderResult[0] < $testOrderResult) { $testsOrderResult = array($testOrderResult, $time); } } $groups = Util::getInvisibleProperty($suite, 'groups', 'getGroupDetails'); $groupsOrderResult = array(static::SORT_NONE, null); foreach ($groups as $groupName => $group) { $groupOrderResult = array(static::SORT_NONE, null); $orderedGroup = new SegmentedQueue($group); $orderedGroup->setMergeMode($this->mergeMode); foreach ($group as $position => $test) { list($testOrderResult, $time) = $this->sortTest($test, $position, $orderedGroup); if ($groupOrderResult[0] < $testOrderResult) { $groupOrderResult = array($testOrderResult, $time); } } if ($groupOrderResult[0] > static::SORT_NONE) { $groups[$groupName] = iterator_to_array($orderedGroup); if ($groupsOrderResult[0] < $groupOrderResult[0]) { $groupsOrderResult = $groupOrderResult; } } } if ($testsOrderResult[0] > static::SORT_NONE) { Util::setInvisibleProperty($suite, 'tests', iterator_to_array($orderedTests), 'setTests'); } if ($groupsOrderResult) { Util::setInvisibleProperty($suite, 'groups', $groups, 'setGroupDetails'); } return $testsOrderResult[0] > $groupsOrderResult[0] ? $testsOrderResult : $groupsOrderResult; }
public function testSetInvalidProperty() { $this->setExpectedException('PHPUnit\\Runner\\CleverAndSmart\\Exception\\PropertyReflectionException', 'Property "invalidProperty" does not exist in hierarchy PHPUnit\\Runner\\CleverAndSmart\\Unit\\Child < PHPUnit\\Runner\\CleverAndSmart\\Unit\\Mother'); Util::setInvisibleProperty(new Child(), 'invalidProperty', 'value'); }