1515 */
1616final class DocumentTest extends TestCase
1717{
18- /**
19- * @var Document
20- */
21- private $ subject ;
22-
23- protected function setUp (): void
24- {
25- $ this ->subject = new Document ();
26- }
27-
2818 /**
2919 * @test
3020 */
3121 public function implementsRenderable (): void
3222 {
33- self ::assertInstanceOf (Renderable::class, $ this -> subject );
23+ self ::assertInstanceOf (Renderable::class, new Document () );
3424 }
3525
3626 /**
3727 * @test
3828 */
3929 public function implementsCommentable (): void
4030 {
41- self ::assertInstanceOf (Commentable::class, $ this -> subject );
31+ self ::assertInstanceOf (Commentable::class, new Document () );
4232 }
4333
4434 /**
4535 * @test
4636 */
4737 public function getContentsInitiallyReturnsEmptyArray (): void
4838 {
49- self ::assertSame ([], $ this ->subject ->getContents ());
39+ $ subject = new Document ();
40+
41+ self ::assertSame ([], $ subject ->getContents ());
5042 }
5143
5244 /**
@@ -70,29 +62,35 @@ public static function contentsDataProvider(): array
7062 */
7163 public function setContentsSetsContents (array $ contents ): void
7264 {
73- $ this ->subject ->setContents ($ contents );
65+ $ subject = new Document ();
66+
67+ $ subject ->setContents ($ contents );
7468
75- self ::assertSame ($ contents , $ this -> subject ->getContents ());
69+ self ::assertSame ($ contents , $ subject ->getContents ());
7670 }
7771
7872 /**
7973 * @test
8074 */
8175 public function setContentsReplacesContentsSetInPreviousCall (): void
8276 {
77+ $ subject = new Document ();
78+
8379 $ contents2 = [new DeclarationBlock ()];
8480
85- $ this -> subject ->setContents ([new DeclarationBlock ()]);
86- $ this -> subject ->setContents ($ contents2 );
81+ $ subject ->setContents ([new DeclarationBlock ()]);
82+ $ subject ->setContents ($ contents2 );
8783
88- self ::assertSame ($ contents2 , $ this -> subject ->getContents ());
84+ self ::assertSame ($ contents2 , $ subject ->getContents ());
8985 }
9086
9187 /**
9288 * @test
9389 */
9490 public function insertContentBeforeInsertsContentBeforeSibling (): void
9591 {
92+ $ subject = new Document ();
93+
9694 $ bogusOne = new DeclarationBlock ();
9795 $ bogusOne ->setSelectors ('.bogus-one ' );
9896 $ bogusTwo = new DeclarationBlock ();
@@ -104,21 +102,23 @@ public function insertContentBeforeInsertsContentBeforeSibling(): void
104102 $ sibling = new DeclarationBlock ();
105103 $ sibling ->setSelectors ('.sibling ' );
106104
107- $ this -> subject ->setContents ([$ bogusOne , $ sibling , $ bogusTwo ]);
105+ $ subject ->setContents ([$ bogusOne , $ sibling , $ bogusTwo ]);
108106
109- self ::assertCount (3 , $ this -> subject ->getContents ());
107+ self ::assertCount (3 , $ subject ->getContents ());
110108
111- $ this -> subject ->insertBefore ($ item , $ sibling );
109+ $ subject ->insertBefore ($ item , $ sibling );
112110
113- self ::assertCount (4 , $ this -> subject ->getContents ());
114- self ::assertSame ([$ bogusOne , $ item , $ sibling , $ bogusTwo ], $ this -> subject ->getContents ());
111+ self ::assertCount (4 , $ subject ->getContents ());
112+ self ::assertSame ([$ bogusOne , $ item , $ sibling , $ bogusTwo ], $ subject ->getContents ());
115113 }
116114
117115 /**
118116 * @test
119117 */
120118 public function insertContentBeforeAppendsIfSiblingNotFound (): void
121119 {
120+ $ subject = new Document ();
121+
122122 $ bogusOne = new DeclarationBlock ();
123123 $ bogusOne ->setSelectors ('.bogus-one ' );
124124 $ bogusTwo = new DeclarationBlock ();
@@ -133,13 +133,13 @@ public function insertContentBeforeAppendsIfSiblingNotFound(): void
133133 $ orphan = new DeclarationBlock ();
134134 $ orphan ->setSelectors ('.forever-alone ' );
135135
136- $ this -> subject ->setContents ([$ bogusOne , $ sibling , $ bogusTwo ]);
136+ $ subject ->setContents ([$ bogusOne , $ sibling , $ bogusTwo ]);
137137
138- self ::assertCount (3 , $ this -> subject ->getContents ());
138+ self ::assertCount (3 , $ subject ->getContents ());
139139
140- $ this -> subject ->insertBefore ($ item , $ orphan );
140+ $ subject ->insertBefore ($ item , $ orphan );
141141
142- self ::assertCount (4 , $ this -> subject ->getContents ());
143- self ::assertSame ([$ bogusOne , $ sibling , $ bogusTwo , $ item ], $ this -> subject ->getContents ());
142+ self ::assertCount (4 , $ subject ->getContents ());
143+ self ::assertSame ([$ bogusOne , $ sibling , $ bogusTwo , $ item ], $ subject ->getContents ());
144144 }
145145}
0 commit comments