Skip to content

Commit 01e9dad

Browse files
committed
ignored test name
1 parent a834a2a commit 01e9dad

File tree

4 files changed

+43
-17
lines changed

4 files changed

+43
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#### 0.4.0
44

55
* Fixes cloning properties in examples. Issue #6 *2014-10-15*
6-
* added global and local specify configs, for disabling cloning properties and changing cloning methods *2014-10-15*
6+
* Added global and local specify configs, for disabling cloning properties and changing cloning methods *2014-10-15*
77

88

99
#### 0.3.6 03/22/2014

src/Codeception/Specify.php

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,7 @@ function specify($specification, \Closure $callable = null, $params = [])
4444

4545
foreach ($examples as $example) {
4646
// copy current object properties
47-
foreach ($properties as $property => $val) {
48-
if ($this->specifyConfig->propertyIgnored($property)) continue;
49-
if ($this->specifyConfig->classIgnored($val)) continue;
50-
51-
if ($this->specifyConfig->propertyIsShallowCloned($property)) {
52-
if (is_object($val)) {
53-
$this->$property = clone $val;
54-
}
55-
}
56-
if ($this->specifyConfig->propertyIsDeeplyCloned($property)) {
57-
$this->$property = $this->copier->copy($val);
58-
}
59-
}
47+
$this->specifyCloneProperties($properties);
6048

6149
if ($this->beforeSpecify instanceof \Closure) $this->beforeSpecify->__invoke();
6250
$this->specifyExecute($test, $throws, $example);
@@ -125,7 +113,7 @@ private function specifyExecute($test, $throws = false, $examples = array())
125113
$this->assertTrue(true, 'exception handled');
126114
} else {
127115
$f = new \PHPUnit_Framework_AssertionFailedError("exception '$throws' was not thrown as expected");
128-
$result->addFailure(clone($this), $f, $result->time());
116+
$result->addFailure(clone($this), $f, $result->time());
129117
}
130118
}
131119
}
@@ -148,7 +136,32 @@ function afterSpecify(\Closure $callable = null)
148136
function cleanSpecify()
149137
{
150138
$this->beforeSpecify = $this->afterSpecify = null;
151-
}
139+
}
152140

141+
/**
142+
* @param $properties
143+
* @return array
144+
*/
145+
private function specifyCloneProperties($properties)
146+
{
147+
foreach ($properties as $property => $val) {
148+
if ($this->specifyConfig->propertyIgnored($property)) {
149+
continue;
150+
}
151+
if ($this->specifyConfig->classIgnored($val)) {
152+
continue;
153+
}
153154

155+
if ($this->specifyConfig->propertyIsShallowCloned($property)) {
156+
if (is_object($val)) {
157+
$this->$property = clone $val;
158+
} else {
159+
$this->$property = $val;
160+
}
161+
}
162+
if ($this->specifyConfig->propertyIsDeeplyCloned($property)) {
163+
$this->$property = $this->copier->copy($val);
164+
}
165+
}
166+
}
154167
}

src/Codeception/Specify/Config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class Config
3434
'dependencies',
3535
'dependencyInput',
3636
'tester',
37-
'guy'
37+
'guy',
38+
'name'
3839
];
3940

4041
protected static $deepClone = true;

tests/SpecifyTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ function testPropertyRestore()
164164
$this->assertEquals(['hello', 'world'], $this->testOne->prop);
165165
}
166166

167+
// public function testFail()
168+
// {
169+
// $this->specify('this will fail', function(){
170+
// $this->assertTrue(false);
171+
// });
172+
//
173+
// $this->specify('this will fail too', function(){
174+
// echo "executed";
175+
// $this->assertTrue(true);
176+
// }, ['throws' => 'Exception']);
177+
// }
178+
167179
}
168180

169181
class TestOne

0 commit comments

Comments
 (0)