Migrate internal tests to the canonical v5 Support layout (#6943) · Codeception/Codeception@eb7a6a2 · GitHub
Skip to content

Commit eb7a6a2

Browse files
authored
Migrate internal tests to the canonical v5 Support layout (#6943)
1 parent a0c973e commit eb7a6a2

95 files changed

Lines changed: 695 additions & 563 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎codeception.yml‎

Lines changed: 3 additions & 2 deletions

‎composer.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@
9292
}
9393
},
9494
"autoload-dev": {
95+
"psr-4": {
96+
"Tests\\Support\\": "tests/Support"
97+
},
9598
"classmap": [
99+
"tests/Support/EmulateModuleHelper.php",
96100
"tests/cli/_steps",
97101
"tests/data/app/data.php",
98102
"tests/data/claypit/tests/_data",

‎tests/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ Example test:
144144

145145
```php
146146
<?php
147-
$I = new CliGuy($scenario);
147+
$I = new \Tests\Support\CliTester($scenario);
148148
$I->wantToTest('build command');
149149
$I->runShellCommand('php codecept build');
150150
$I->seeInShellOutput('generated successfully');
151-
$I->seeFileFound('CodeGuy.php','tests/unit');
152-
$I->seeFileFound('CliGuy.php','tests/cli');
151+
$I->seeFileFound('CodeTester.php','tests/unit');
152+
$I->seeFileFound('CliTester.php','tests/cli');
153153
$I->seeInThisFile('seeFileFound(');
154154
?>
155155
```

‎tests/Support/CliTester.php‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Support;
6+
7+
/**
8+
* Inherited Methods
9+
* @method void wantTo($text)
10+
* @method void wantToTest($text)
11+
* @method void execute($callable)
12+
* @method void expectTo($prediction)
13+
* @method void expect($prediction)
14+
* @method void amGoingTo($argumentation)
15+
* @method void am($role)
16+
* @method void lookForwardTo($achieveValue)
17+
* @method void comment($description)
18+
* @method void pause($vars = [])
19+
*
20+
* @SuppressWarnings(PHPMD)
21+
*/
22+
class CliTester extends \Codeception\Actor
23+
{
24+
use _generated\CliTesterActions;
25+
26+
public function seeInSupportDir(string $file)
27+
{
28+
$this->seeFileFound($file, 'tests/Support');
29+
}
30+
}

‎tests/Support/CodeTester.php‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Support;
6+
7+
/**
8+
* Inherited Methods
9+
* @method void wantTo($text)
10+
* @method void wantToTest($text)
11+
* @method void execute($callable)
12+
* @method void expectTo($prediction)
13+
* @method void expect($prediction)
14+
* @method void amGoingTo($argumentation)
15+
* @method void am($role)
16+
* @method void lookForwardTo($achieveValue)
17+
* @method void comment($description)
18+
* @method void pause($vars = [])
19+
*
20+
* @SuppressWarnings(PHPMD)
21+
*/
22+
class CodeTester extends \Codeception\Actor
23+
{
24+
use _generated\CodeTesterActions;
25+
26+
public function codeGuyMethod(): string
27+
{
28+
return 'codeGuyMethod() exists';
29+
}
30+
}

‎tests/Support/CoverTester.php‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Support;
6+
7+
/**
8+
* Inherited Methods
9+
* @method void wantTo($text)
10+
* @method void wantToTest($text)
11+
* @method void execute($callable)
12+
* @method void expectTo($prediction)
13+
* @method void expect($prediction)
14+
* @method void amGoingTo($argumentation)
15+
* @method void am($role)
16+
* @method void lookForwardTo($achieveValue)
17+
* @method void comment($description)
18+
* @method void pause($vars = [])
19+
*
20+
* @SuppressWarnings(PHPMD)
21+
*/
22+
class CoverTester extends \Codeception\Actor
23+
{
24+
use _generated\CoverTesterActions;
25+
26+
public function seeCoverageStatsNotEmpty()
27+
{
28+
$this->seeShellOutputMatches(
29+
'#info\n\s+Methods:\s+\d+\.\d+% \( [01]/ 1\)\s+Lines:\s+\d+\.\d+% \( [345]/ [345]\)#s'
30+
);
31+
}
32+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Codeception\Module;
3+
namespace Tests\Support\Helper;
44

55
class CliHelper extends \Codeception\Module
66
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Codeception\Module;
3+
namespace Tests\Support\Helper;
44

55
class CodeHelper extends \Codeception\Module
66
{
Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)