Skip to content

Commit ce6140c

Browse files
committed
Updated docs for 1.4.x
1 parent 6258e89 commit ce6140c

4 files changed

Lines changed: 148 additions & 71 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
.idea
3+
.phpunit.result.cache
34
composer.phar

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
## 1.4
4+
5+
* Improved code quality and maintainability.
6+
* Used strict types and namespaces.
7+
Created exception `InvalidVerifyException.php` in case verify is used with some invalid data.
8+
* Added documentation for all verifiers.
9+
* Divided the verifiers into traits depending on the type of data they verify.
10+
* Added data validations with php issers functions and instanceof.
11+
12+
* **BC:** `equalXMLStructure` and its corresponding test were removed.
13+
* **BC:** hasntKey verifier renamed to hasNotKey for clarity.
14+
* **BC:** Removed support for PHP 7.0 and its corresponding versions of `PHPUnit` and `phpunit-wrapper`.

README.md

Lines changed: 25 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@ Verify
33

44
BDD Assertions for [PHPUnit][1] or [Codeception][2]
55

6+
[![Latest Stable Version](https://poser.pugx.org/codeception/verify/v/stable)](https://packagist.org/packages/codeception/verify)
7+
[![Total Downloads](https://poser.pugx.org/codeception/verify/downloads)](https://packagist.org/packages/codeception/verify)
8+
[![Build Status](https://travis-ci.org/Codeception/Verify.png?branch=master)](https://travis-ci.org/Codeception/Verify)
9+
[![License](https://poser.pugx.org/codeception/specify/license)](https://packagist.org/packages/codeception/verify)
10+
611
This is very tiny wrapper for PHPUnit assertions, that are aimed to make tests a bit more readable.
712
With [BDD][3] assertions influenced by [Chai][4], [Jasmine][5], and [RSpec][6] your assertions would be a bit closer to natural language.
813

9-
[![Build Status](https://travis-ci.org/Codeception/Verify.png?branch=master)](https://travis-ci.org/Codeception/Verify)
10-
[![Latest Stable Version](https://poser.pugx.org/codeception/verify/v/stable)](https://packagist.org/packages/codeception/verify)
11-
[![Total Downloads](https://poser.pugx.org/codeception/verify/downloads)](https://packagist.org/packages/codeception/verify)
14+
## Installation
15+
16+
*Requires PHP 7.1 or higher*
17+
18+
```
19+
composer require codeception/verify --dev
20+
```
21+
22+
## Usage
23+
24+
Use in any test `verify` function instead of `$this->assert*` methods:
1225

1326
```php
1427
$user = User::find(1);
@@ -29,8 +42,6 @@ verify('first user rate is 7', $rate)->equals(7);
2942
verify($rate)->greaterThan(5);
3043
verify($rate)->lessThan(10);
3144
verify($rate)->lessOrEquals(7);
32-
verify($rate)->lessOrEquals(8);
33-
verify($rate)->greaterOrEquals(7);
3445
verify($rate)->greaterOrEquals(5);
3546

3647
// true / false / null
@@ -52,52 +63,21 @@ verify($callback)->throws(new Exception('message'));
5263

5364
// does not throw
5465
verify($callback)->doesNotThrow();
55-
verify($callback)->doesNotThrow(Exception::class);
56-
verify($callback)->doesNotThrow(Exception::class, 'exception message');
66+
verify($callback)->throws(Exception::class);
5767
verify($callback)->doesNotThrow(new Exception());
58-
verify($callback)->doesNotThrow(new Exception('exception message'));
59-
60-
//Other methods:
61-
* stringContainsString
62-
* stringNotContainsString
63-
* stringContainsStringIgnoringCase
64-
* stringNotContainsStringIgnoringCase
65-
* array
66-
* bool
67-
* float
68-
* int
69-
* numeric
70-
* object
71-
* resource
72-
* string
73-
* scalar
74-
* callable
75-
* notArray
76-
* notBool
77-
* notFloat
78-
* notInt
79-
* notNumeric
80-
* notObject
81-
* notResource
82-
* notString
83-
* notScalar
84-
* notCallable
85-
* equalsCanonicalizing
86-
* notEqualsCanonicalizing
87-
* equalsIgnoringCase
88-
* notEqualsIgnoringCase
89-
* equalsWithDelta
90-
* notEqualsWithDelta
68+
69+
// and many more !
9170
```
9271

72+
> ##### :page_facing_up: See Verifiers full list [here.][7]
73+
9374
Shorthands for testing truth/fallacy:
9475

9576
```php
9677
verify_that($user->isActivated());
9778
verify_not($user->isBanned());
9879
```
9980

100-
10181
These two functions don't check for strict true/false matching, rather `empty` function is used.
10282
`verify_that` checks that result is not empty value, `verify_not` does the opposite.
10383

@@ -111,34 +91,6 @@ expect_that($user->isActive());
11191
expect_not($user->isBanned());
11292
```
11393

114-
## Installation
115-
116-
### Installing via Composer
117-
118-
Install composer in a common location or in your project:
119-
120-
```sh
121-
curl -s http://getcomposer.org/installer | php
122-
```
123-
124-
Create the `composer.json` file as follows:
125-
126-
```json
127-
"require-dev": {
128-
"codeception/verify": "^1.0"
129-
}
130-
```
131-
132-
Run the composer installer:
133-
134-
```sh
135-
php composer.phar install
136-
```
137-
138-
## Usage
139-
140-
Use in any test `verify` function instead of `$this->assert*` methods.
141-
14294
## Extending
14395

14496
In order to add more assertions you can override `Codeception\Verify` class:
@@ -165,12 +117,14 @@ verify('it works')->success();
165117

166118
## License
167119

168-
Verify is open-sourced software licensed under the [MIT][7] License. © Codeception PHP Testing Framework
120+
Verify is open-sourced software licensed under the [MIT][8] License.
121+
© Codeception PHP Testing Framework
169122

170123
[1]: https://phpunit.de/
171124
[2]: http://codeception.com/
172125
[3]: https://en.wikipedia.org/wiki/Behavior-driven_development
173126
[4]: http://chaijs.com/
174127
[5]: http://jasmine.github.io/
175128
[6]: http://rspec.info/
176-
[7]: https://github.com/Codeception/Verify/blob/master/LICENSE
129+
[7]: /docs/supported_verifiers.md
130+
[8]: /LICENSE

docs/supported_verifiers.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
## Verifiers List
2+
3+
### Array
4+
```
5+
contains
6+
containsOnly
7+
containsOnlyInstancesOf
8+
count
9+
hasKey
10+
hasNotKey
11+
notContains
12+
notContainsOnly
13+
notCount
14+
```
15+
16+
### File
17+
```
18+
setIsFileExpectation
19+
equals
20+
notEquals
21+
exists
22+
notExists
23+
equalsJsonFile
24+
equalsXmlFile
25+
```
26+
27+
### Mixed
28+
```
29+
isEmpty
30+
equalsCanonicalizing
31+
equalsIgnoringCase
32+
equalsWithDelta
33+
false
34+
greaterThan
35+
greaterOrEquals
36+
isInstanceOf
37+
array
38+
bool
39+
callable
40+
float
41+
int
42+
notArray
43+
notBool
44+
notCallable
45+
notFloat
46+
notInt
47+
notNumeric
48+
notObject
49+
notResource
50+
notScalar
51+
notString
52+
numeric
53+
object
54+
resource
55+
scalar
56+
string
57+
lessThan
58+
lessOrEquals
59+
notEmpty
60+
notEqualsCanonicalizing
61+
notEqualsIgnoringCase
62+
notEqualsWithDelta
63+
isNotInstanceOf
64+
notNull
65+
notSame
66+
null
67+
same
68+
true
69+
```
70+
71+
### String
72+
```
73+
hasStaticAttribute
74+
notHasStaticAttribute
75+
equalsJsonString
76+
regExp
77+
stringContainsString
78+
stringContainsStringIgnoringCase
79+
notEndsWith
80+
endsWith
81+
equalsFile
82+
matchesFormat
83+
matchesFormatFile
84+
stringNotContainsString
85+
stringNotContainsStringIgnoringCase
86+
notMatchesFormat
87+
notMatchesFormatFile
88+
notStartsWith
89+
startsWith
90+
notEqualsFile
91+
```
92+
93+
### Object/String
94+
```
95+
hasAttribute
96+
notHasAttribute
97+
```
98+
99+
### Throwable
100+
```
101+
throws
102+
doesNotThrow
103+
```
104+
105+
### Xml
106+
```
107+
equalsXmlString
108+
```

0 commit comments

Comments
 (0)