8000 Tests for skip annotation and attribute · Codeception/Codeception@8da5932 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8da5932

Browse files
committed
Tests for skip annotation and attribute
1 parent 9716261 commit 8da5932

14 files changed

+263
-0
lines changed

tests/cli/RunSkippedCest.php

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
class RunSkippedCest
4+
{
5+
public function classLevelSkipAnnotationWithMessage(CliGuy $I): void
6+
{
7+
$I->amInPath('tests/data/skip');
8+
$I->executeCommand('run -v --no-ansi unit ClassLevelSkipAnnotationWithMessageCest.php');
9+
$I->seeInShellOutput("S ClassLevelSkipAnnotationWithMessageCest: Method1");
10+
$I->seeInShellOutput("S ClassLevelSkipAnnotationWithMessageCest: Method2");
11+
$I->seeInShellOutput('Skip message');
12+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
13+
}
14+
15+
public function classLevelSkipAnnotationWithoutMessage(CliGuy $I): void
16+
{
17+
$I->amInPath('tests/data/skip');
18+
$I->executeCommand('run -v --no-ansi unit ClassLevelSkipAnnotationWithoutMessageCest.php');
19+
$I->seeInShellOutput("S ClassLevelSkipAnnotationWithoutMessageCest: Method1");
20+
$I->seeInShellOutput("S ClassLevelSkipAnnotationWithoutMessageCest: Method2");
21+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
22+
}
23+
24+
public function classLevelSkipAttributeWithMessage(CliGuy $I): void
25+
{
26+
$I->amInPath('tests/data/skip');
27+
$I->executeCommand('run -v --no-ansi unit ClassLevelSkipAttributeWithMessageCest.php');
28+
$I->seeInShellOutput("S ClassLevelSkipAttributeWithMessageCest: Method1");
29+
$I->seeInShellOutput("S ClassLevelSkipAttributeWithMessageCest: Method2");
30+
$I->seeInShellOutput('Skip message');
31+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
32+
}
33+
34+
public function classLevelSkipAttributeWithoutMessage(CliGuy $I): void
35+
{
36+
$I->amInPath('tests/data/skip');
37+
$I->executeCommand('run -v --no-ansi unit ClassLevelSkipAttributeWithoutMessageCest.php');
38+
$I->seeInShellOutput("S ClassLevelSkipAttributeWithoutMessageCest: Method1");
39+
$I->seeInShellOutput("S ClassLevelSkipAttributeWithoutMessageCest: Method2");
40+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
41+
}
42+
43+
public function methodLevelSkipAnnotationWithMessage(CliGuy $I): void
44+
{
45+
$I->amInPath('tests/data/skip');
46+
$I->executeCommand('run -v --no-ansi unit MethodLevelSkipAnnotationWithMessageCest.php');
47+
$I->seeInShellOutput("+ MethodLevelSkipAnnotationWithMessageCest: Method1");
48+
$I->seeInShellOutput("S MethodLevelSkipAnnotationWithMessageCest: Method2");
49+
$I->seeInShellOutput('Skip message');
50+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
51+
}
52+
53+
public function methodLevelSkipAnnotationWithoutMessage(CliGuy $I): void
54+
{
55+
$I->amInPath('tests/data/skip');
56+
$I->executeCommand('run -v --no-ansi unit MethodLevelSkipAnnotationWithoutMessageCest.php');
57+
$I->seeInShellOutput("+ MethodLevelSkipAnnotationWithoutMessageCest: Method1");
58+
$I->seeInShellOutput("S MethodLevelSkipAnnotationWithoutMessageCest: Method2");
59+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
60+
}
61+
62+
public function methodLevelSkipAttributeWithMessage(CliGuy $I): void
63+
{
64+
$I->amInPath('tests/data/skip');
65+
$I->executeCommand('run -v --no-ansi unit MethodLevelSkipAttributeWithMessageCest.php');
66+
$I->seeInShellOutput("S MethodLevelSkipAttributeWithMessageCest: Method1");
67+
$I->seeInShellOutput("+ MethodLevelSkipAttributeWithMessageCest: Method2");
68+
$I->seeInShellOutput('Skip message');
69+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
70+
}
71+
72+
public function methodLevelSkipAttributeWithoutMessage(CliGuy $I): void
73+
{
74+
$I->amInPath('tests/data/skip');
75+
$I->executeCommand('run -v --no-ansi unit MethodLevelSkipAttributeWithoutMessageCest.php');
76+
$I->seeInShellOutput("+ MethodLevelSkipAttributeWithoutMessageCest: Method1");
77+
$I->seeInShellOutput("S MethodLevelSkipAttributeWithoutMessageCest: Method2");
78+
$I->seeInShellOutput('OK, but incomplete, skipped, or useless tests!');
79+
}
80+
}

tests/data/skip/codeception.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
paths:
2+
tests: tests
3+
output: tests/_output
4+
data: tests/_data
5+
support: tests/_support
6+
envs: tests/_envs
7+
actor_suffix: Tester
8+
settings:
9+
colors: false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/**
4+
* Inherited Methods
5+
* @method void wantToTest($text)
6+
* @method void wantTo($text)
7+
* @method self execute($callable)
8+
* @method self expectTo($prediction)
9+
* @method self expect($prediction)
10+
* @method self amGoingTo($argumentation)
11+
* @method self am($role)
12+
* @method self lookForwardTo($achieveValue)
13+
* @method self comment($description)
14+
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
15+
*
16+
* @SuppressWarnings(PHPMD)
17+
*/
18+
class UnitTester extends \Codeception\Actor
19+
{
20+
use _generated\UnitTesterActions;
21+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

tests/data/skip/tests/unit.suite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
actor: UnitTester
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Unit;
4+
5+
use UnitTester;
6+
7+
/**
8+
* @skip Skip message
9+
*/
10+
class ClassLevelSkipAnnotationWithMessageCest
11+
{
12+
public function method1(UnitTester $I)
13+
{
14+
}
15+
16+
public function method2(UnitTester $I)
17+
{
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Unit;
4+
5+
use UnitTester;
6+
7+
/**
8+
* @skip
9+
*/
10+
class ClassLevelSkipAnnotationWithoutMessageCest
11+
{
12+
public function method1(UnitTester $I)
13+
{
14+
}
15+
16+
public function method2(UnitTester $I)
17+
{
18+
}
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Unit;
4+
5+
use Codeception\Attribute\Skip;
6+
use UnitTester;
7+
8+
#[Skip('Skip message')]
9+
class ClassLevelSkipAttributeWithMessageCest
10+
{
11+
public function method1(UnitTester $I)
12+
{
13+
}
14+
15+
public function method2(UnitTester $I)
16+
{
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Unit;
4+
5+
use Codeception\Attribute\Skip;
6+
use UnitTester;
7+
8+
#[Skip]
9+
class ClassLevelSkipAttributeWithoutMessageCest
10+
{
11+
public function method1(UnitTester $I)
12+
{
13+
}
14+
15+
public function method2(UnitTester $I)
16+
{
17+
}
18+
}

0 commit comments

Comments
 (0)
0