Skip to content

Commit

Permalink
Split Task for newer Phpunit
Browse files Browse the repository at this point in the history
**Context**

Phpunit has restructure its classes with namespace starting from
version 6 and this breaks the `DataProvider` test splitting.

This update will allow it to work for both old and new Phpunit.
  • Loading branch information
taufek committed Dec 13, 2018
1 parent 88be7ae commit ed8d29a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SplitTestsByGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

use Codeception\Test\Descriptor as TestDescriptor;
use Codeception\Test\Loader as TestLoader;
use \PHPUnit_Framework_TestSuite_DataProvider as DataProviderTestSuite;
use \PHPUnit\Framework\DataProviderTestSuite as DataProviderTestSuite;
use \PHPUnit_Framework_TestSuite_DataProvider as DataProvider;
use Robo\Contract\TaskInterface;
use Robo\Exception\TaskException;
use Robo\Task\BaseTask;
Expand Down Expand Up @@ -94,7 +95,7 @@ public function run()
$this->printTaskInfo('Processing ' . count($tests) . ' tests');
// splitting tests by groups
foreach ($tests as $test) {
if ($test instanceof DataProviderTestSuite) {
if ($test instanceof DataProvider || $test instanceof DataProviderTestSuite) {
$test = current($test->tests());
}
$groups[($i % $this->numGroups) + 1][] = TestDescriptor::getTestFullName($test);
Expand Down

0 comments on commit ed8d29a

Please sign in to comment.