Skip to content

Commit e955466

Browse files
committed
readme
1 parent ff68bff commit e955466

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

README.md

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ $this->assertEquals('davert', $this->user->name);
6464
?>
6565
```
6666

67-
6867
Failure in `specify` block won't get your test stopped.
6968

7069
``` php
@@ -80,6 +79,48 @@ $this->assertTrue(true);
8079

8180
If a test fails you will specification text in the result.
8281

82+
## Isolation
83+
84+
Isolation is achieved by **cloning object properties** for each specify block.
85+
By default objects are cloned using deep cloning method.
86+
This behavior can be customized in order to speed up test execution by preventing some objects from cloning or switching to shallow cloning using `clone` operator.
87+
Some properties can be ignored from cloning using either global or local config settings.
88+
89+
### Global
90+
91+
Cloning configuration can be set globally
92+
93+
```php
94+
<?php
95+
// globally disabling cloning of properties
96+
Codeception\Specify\Config::setIgnoredProperties(['user', 'repository']);
97+
?>
98+
```
99+
100+
See complete [reference](https://github.com/Codeception/Specify/blob/master/docs/GlobalConfig.md).
101+
102+
### Local
103+
104+
Configuring can be done locally per test case
105+
106+
```php
107+
<?php
108+
class UserTest extends \PHPUnit_Framework_TestCase
109+
{
110+
use Codeception\Specify;
111+
112+
function testUser()
113+
{
114+
// do not deep clone user property
115+
$this->specifyConfig()
116+
->shallowClone('user');
117+
}
118+
}
119+
```
120+
121+
[Reference](https://github.com/Codeception/Specify/blob/master/docs/LocalConfig.md)
122+
123+
83124
## Exceptions
84125

85126
You can wait for exception thrown inside a block.
@@ -166,45 +207,5 @@ Install with Composer:
166207
```
167208
Include `Codeception\Specifiy` trait into your test.
168209

169-
## Configuration
170-
171-
Specify clones all properties of current testcase for all specify blocks.
172-
By default Specify clones all objects using deep cloning method.
173-
This behavior can be customized in order to speed up test execution by preventing some objects from cloning or switching to shallow cloning using `clone` operator.
174-
175-
### Global
176-
177-
Configation can be set globally
178-
179-
```php
180-
<?php
181-
// globally disabling cloning of properties
182-
Codeception\Specify\Config::setIgnoredProperties(['user', 'repository']);
183-
?>
184-
```
185-
186-
See complete [reference](https://github.com/Codeception/Specify/blob/master/docs/GlobalConfig.md).
187-
188-
### Local
189-
190-
Configuring can be done locally per test case
191-
192-
```php
193-
<?php
194-
class UserTest extends \PHPUnit_Framework_TestCase
195-
{
196-
use Codeception\Specify;
197-
198-
function testUser()
199-
{
200-
// do not deep clone user property
201-
$this->specifyConfig()
202-
->shallowClone('user');
203-
}
204-
}
205-
```
206-
207-
[Reference](https://github.com/Codeception/Specify/blob/master/docs/LocalConfig.md)
208-
209210

210211
License: MIT

0 commit comments

Comments
 (0)