Skip to content

Commit 9ad0039

Browse files
committed
rollback naming conventions
1 parent a6731ce commit 9ad0039

5 files changed

Lines changed: 100 additions & 101 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ composer require codeception/verify --dev
2424

2525
## Usage
2626

27-
Use in any test `Verify` function instead of `$this->assert*` methods:
27+
Use in any test `verify` function instead of `$this->assert*` methods:
2828

2929
```php
3030
use Codeception\Verify\Verify;
3131

3232
$user = User::find(1);
3333

3434
// equals
35-
Verify($user->getName())->equals('davert');
35+
verify($user->getName())->equals('davert');
3636

37-
Verify($user->getNumPosts())
37+
verify($user->getNumPosts())
3838
->equals(5, 'user have 5 posts')
3939
->notEquals(3);
4040

@@ -45,20 +45,20 @@ Verify::Array($user->getRoles())
4545

4646

4747
// greater / less
48-
Verify($user->getRate())
48+
verify($user->getRate())
4949
->greaterThan(5)
5050
->lessThan(10)
5151
->equals(7, 'first user rate is 7');
5252

5353
// true / false / null
54-
Verify($user->isAdmin())->true();
55-
Verify($user->isBanned())->false();
56-
Verify($user->invitedBy)->null();
57-
Verify($user->getPosts())->notNull();
54+
verify($user->isAdmin())->true();
55+
verify($user->isBanned())->false();
56+
verify($user->invitedBy)->null();
57+
verify($user->getPosts())->notNull();
5858

5959
// empty
60-
Verify($user->getComments())->empty();
61-
Verify($user->getRoles())->notEmpty();
60+
verify($user->getComments())->empty();
61+
verify($user->getRoles())->notEmpty();
6262

6363
// throws
6464
Verify::Callable($callback)
@@ -81,12 +81,12 @@ Verify::Callable($callback)
8181
8282
## Alternative Syntax
8383

84-
If you follow TDD/BDD you'd rather use `Expect` or `VerifyThat` instead of `Verify`. Which are just an alias function:
84+
If you follow TDD/BDD you'd rather use `expect` or `verify_that` instead of `verify`. Which are just an alias function:
8585

8686
```php
87-
Expect($user->getNumPosts())->equals(5, 'user have 5 posts');
87+
expect($user->getNumPosts())->equals(5, 'user have 5 posts');
8888

89-
VerifyThat($user->getRate())->equals(7, 'first user rate is 7');
89+
verify_that($user->getRate())->equals(7, 'first user rate is 7');
9090
```
9191

9292
## Extending

UPGRADE.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,41 @@ That is why **we have deleted verifiers as global functions** and we have used a
1919

2020
According to the above:
2121

22-
* `Verify` no longer receives a `string $message` as a parameter, now each _**verifier**_ fulfills this function.
23-
* `verify_that` was deleted. Use `VerifyThat` instead.
24-
* `verify_not` was deleted. Use `Verify()->empty` instead.
25-
* `expect_that` and `expect_not` were deleted. Use `Expect()->notEmpty` and `Expect()->empty` instead.
22+
* `verify` no longer receives a `string $message` as a parameter, now each _**verifier**_ fulfills this function.
23+
* `verify_not` was deleted. Use `verify()->empty` instead.
24+
* `expect_that` and `expect_not` were deleted. Use `expect()->notEmpty` and `expect()->empty` instead.
2625
* `expect_file` and `setIsFileExpectation` were deleted. Use `Verify::File()` instead.
2726

2827
Verifiers
2928
-------
3029

3130
| Verify 1.x | Verify 2.x |
3231
|-------------------------------------------------|---------------------------------------------------|
33-
| `verify()->array` | `Verify()->isArray` |
34-
| `verify()->bool` | `Verify()->isBool` |
35-
| `verify()->callable` | `Verify()->isCallable` |
36-
| `verify()->float` | `Verify()->isFloat` |
37-
| `verify()->greaterOrEquals` | `Verify()->greaterThanOrEqual` |
38-
| `verify()->int` | `Verify()->isInt` |
39-
| `verify()->isEmpty` | `Verify()->empty` |
40-
| `verify()->isInstanceOf` | `Verify()->instanceOf` |
41-
| `verify()->isNotInstanceOf` | `Verify()->notInstanceOf` |
42-
| `verify()->lessOrEquals` | `Verify()->lessThanOrEqual` |
43-
| `verify()->notArray` | `Verify()->isNotArray` |
44-
| `verify()->notBool` | `Verify()->isNotBool` |
45-
| `verify()->notCallable` | `Verify()->isNotCallable` |
46-
| `verify()->notFloat` | `Verify()->isNotFloat` |
47-
| `verify()->notInt` | `Verify()->isNotInt` |
48-
| `verify()->notNumeric` | `Verify()->isNotNumeric` |
49-
| `verify()->notObject` | `Verify()->isNotObject` |
50-
| `verify()->notResource` | `Verify()->isNotResource` |
51-
| `verify()->notScalar` | `Verify()->isNotScalar` |
52-
| `verify()->notString` | `Verify()->isNotString` |
53-
| `verify()->numeric` | `Verify()->isNumeric` |
54-
| `verify()->object` | `Verify()->isObject` |
55-
| `verify()->resource` | `Verify()->isResource` |
56-
| `verify()->scalar` | `Verify()->isScalar` |
57-
| `verify()->string` | `Verify()->isString` |
32+
| `verify()->array` | `verify()->isArray` |
33+
| `verify()->bool` | `verify()->isBool` |
34+
| `verify()->callable` | `verify()->isCallable` |
35+
| `verify()->float` | `verify()->isFloat` |
36+
| `verify()->greaterOrEquals` | `verify()->greaterThanOrEqual` |
37+
| `verify()->int` | `verify()->isInt` |
38+
| `verify()->isEmpty` | `verify()->empty` |
39+
| `verify()->isInstanceOf` | `verify()->instanceOf` |
40+
| `verify()->isNotInstanceOf` | `verify()->notInstanceOf` |
41+
| `verify()->lessOrEquals` | `verify()->lessThanOrEqual` |
42+
| `verify()->notArray` | `verify()->isNotArray` |
43+
| `verify()->notBool` | `verify()->isNotBool` |
44+
| `verify()->notCallable` | `verify()->isNotCallable` |
45+
| `verify()->notFloat` | `verify()->isNotFloat` |
46+
| `verify()->notInt` | `verify()->isNotInt` |
47+
| `verify()->notNumeric` | `verify()->isNotNumeric` |
48+
| `verify()->notObject` | `verify()->isNotObject` |
49+
| `verify()->notResource` | `verify()->isNotResource` |
50+
| `verify()->notScalar` | `verify()->isNotScalar` |
51+
| `verify()->notString` | `verify()->isNotString` |
52+
| `verify()->numeric` | `verify()->isNumeric` |
53+
| `verify()->object` | `verify()->isObject` |
54+
| `verify()->resource` | `verify()->isResource` |
55+
| `verify()->scalar` | `verify()->isScalar` |
56+
| `verify()->string` | `verify()->isString` |
5857
| `verify()->hasAttribute` | `Verify::BaseObject()->hasAttribute` |
5958
| `verify()->notHasAttribute` | `Verify::BaseObject()->notHasAttribute` |
6059
| `verify()->throws` | `Verify::Callable()->throws` |

src/Codeception/bootstrap.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22

33
use Codeception\Verify\Verifiers\VerifyMixed;
44

5-
if (!function_exists('Verify'))
5+
if (!function_exists('verify'))
66
{
77
/**
88
* @param mixed $actual
99
* @return VerifyMixed
1010
*/
11-
function Verify($actual): VerifyMixed
11+
function verify($actual): VerifyMixed
1212
{
1313
return new VerifyMixed($actual);
1414
}
1515
}
1616

17-
if (!function_exists('VerifyThat'))
17+
if (!function_exists('verify_that'))
1818
{
1919
/**
2020
* @param mixed $actual
2121
* @return VerifyMixed
2222
*/
23-
function VerifyThat($actual): VerifyMixed
23+
function verify_that($actual): VerifyMixed
2424
{
2525
return new VerifyMixed($actual);
2626
}
2727
}
2828

29-
if (!function_exists('Expect'))
29+
if (!function_exists('expect'))
3030
{
3131
/**
3232
* @param mixed $actual
3333
* @return VerifyMixed
3434
*/
35-
function Expect($actual): VerifyMixed {
35+
function expect($actual): VerifyMixed {
3636
return new VerifyMixed($actual);
3737
}
3838
}

tests/InheritanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function testVerifyCanBeExtended(): void
1818

1919
$myVerify::Mixed('this also')->notEquals('works');
2020

21-
Verify(new MyVerify())->instanceOf(Verify::class);
21+
verify(new MyVerify())->instanceOf(Verify::class);
2222
}
2323
}
2424

0 commit comments

Comments
 (0)