This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ abstract class AbstractMemberGenerator extends AbstractGenerator
36
36
/**#@-*/
37
37
38
38
/**
39
- * @var DocBlockGenerator
39
+ * @var DocBlockGenerator|null
40
40
*/
41
41
protected $ docBlock ;
42
42
@@ -236,8 +236,13 @@ public function setDocBlock($docBlock)
236
236
return $ this ;
237
237
}
238
238
239
+ public function removeDocBlock (): void
240
+ {
241
+ $ this ->docBlock = null ;
242
+ }
243
+
239
244
/**
240
- * @return DocBlockGenerator
245
+ * @return DocBlockGenerator|null
241
246
*/
242
247
public function getDocBlock ()
243
248
{
Original file line number Diff line number Diff line change 11
11
12
12
use PHPUnit \Framework \TestCase ;
13
13
use Zend \Code \Generator \AbstractMemberGenerator ;
14
+ use Zend \Code \Generator \DocBlockGenerator ;
14
15
use Zend \Code \Generator \Exception \InvalidArgumentException ;
15
16
16
17
class AbstractMemberGeneratorTest extends TestCase
@@ -43,4 +44,21 @@ public function testSetDocBlockThrowsExceptionWithInvalidType()
43
44
$ this ->expectException (InvalidArgumentException::class);
44
45
$ this ->fixture ->setDocBlock (new \stdClass ());
45
46
}
47
+
48
+ public function testRemoveDocBlock (): void
49
+ {
50
+ $ this ->fixture ->setDocBlock (new DocBlockGenerator ());
51
+
52
+ $ this ->fixture ->removeDocBlock ();
53
+
54
+ $ this ->assertNull ($ this ->fixture ->getDocBlock ());
55
+ }
56
+
57
+ public function testRemoveDocBlockIsIdempotent (): void
58
+ {
59
+ $ this ->fixture ->removeDocBlock ();
60
+ $ this ->fixture ->removeDocBlock ();
61
+
62
+ $ this ->assertNull ($ this ->fixture ->getDocBlock ());
63
+ }
46
64
}
You can’t perform that action at this time.
0 commit comments