Skip to content

Commit 08c065c

Browse files
authored
Merge pull request #23 from markizzoo/feature/add-feature-handling
*.feature files handle
2 parents c7356fe + b7ea0c4 commit 08c065c

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/SplitTestsByGroups.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,30 @@ public function __construct($groups)
3434
{
3535
$this->numGroups = $groups;
3636
}
37-
37+
3838
public function projectRoot($path)
3939
{
4040
$this->projectRoot = $path;
41+
4142
return $this;
4243
}
4344

4445
public function testsFrom($path)
4546
{
4647
$this->testsFrom = $path;
48+
4749
return $this;
4850
}
4951

5052
public function groupsTo($pattern)
5153
{
5254
$this->saveTo = $pattern;
55+
5356
return $this;
5457
}
5558
}
5659

5760
/**
58-
*
5961
* Loads all tests into groups and saves them to groupfile according to pattern.
6062
*
6163
* ``` php
@@ -72,7 +74,7 @@ class SplitTestsByGroupsTask extends TestsSplitter implements TaskInterface
7274
public function run()
7375
{
7476
if (!class_exists('\Codeception\Test\Loader')) {
75-
throw new TaskException($this, "This task requires Codeception to be loaded. Please require autoload.php of Codeception");
77+
throw new TaskException($this, 'This task requires Codeception to be loaded. Please require autoload.php of Codeception');
7678
}
7779
$testLoader = new \Codeception\Test\Loader(['path' => $this->testsFrom]);
7880
$testLoader->loadTests($this->testsFrom);
@@ -81,7 +83,7 @@ public function run()
8183
$i = 0;
8284
$groups = [];
8385

84-
$this->printTaskInfo("Processing ".count($tests)." tests");
86+
$this->printTaskInfo('Processing ' . count($tests) . ' tests');
8587
// splitting tests by groups
8688
foreach ($tests as $test) {
8789
$groups[($i % $this->numGroups) + 1][] = \Codeception\Test\Descriptor::getTestFullName($test);
@@ -99,7 +101,7 @@ public function run()
99101

100102
/**
101103
* Finds all test files and splits them by group.
102-
* Unlike `SplitTestsByGroupsTask` does not load them into memory and not requires Codeception to be loaded
104+
* Unlike `SplitTestsByGroupsTask` does not load them into memory and not requires Codeception to be loaded.
103105
*
104106
* ``` php
105107
* <?php
@@ -113,20 +115,20 @@ public function run()
113115
*/
114116
class SplitTestFilesByGroupsTask extends TestsSplitter implements TaskInterface
115117
{
116-
117118
public function run()
118119
{
119120
$files = Finder::create()
120-
->name("*Cept.php")
121-
->name("*Cest.php")
122-
->name("*Test.php")
121+
->name('*Cept.php')
122+
->name('*Cest.php')
123+
->name('*Test.php')
124+
->name('*.feature')
123125
->path($this->testsFrom)
124126
->in($this->projectRoot ? $this->projectRoot : getcwd());
125127

126128
$i = 0;
127129
$groups = [];
128130

129-
$this->printTaskInfo("Processing ".count($files)." files");
131+
$this->printTaskInfo('Processing ' . count($files) . ' files');
130132
// splitting tests by groups
131133
/** @var SplFileInfo $file */
132134
foreach ($files as $file) {

0 commit comments

Comments
 (0)