9
9
use PHPUnit \Framework \TestCase ;
10
10
use Sabberworm \CSS \Comment \Comment ;
11
11
use Sabberworm \CSS \Tests \Unit \Comment \Fixtures \ConcreteCommentContainer ;
12
- use TRegx \DataProvider \DataProviders ;
12
+ use TRegx \PhpUnit \DataProviders \ DataProvider ;
13
13
14
14
/**
15
15
* @covers \Sabberworm\CSS\Comment\CommentContainer
@@ -42,10 +42,12 @@ public function provideCommentArray(): array
42
42
return [
43
43
'no comment ' => [[]],
44
44
'one comment ' => [[new Comment ('Is this really a spoon? ' )]],
45
- 'two comments ' => [[
46
- new Comment ('I’m a teapot. ' ),
47
- new Comment ('I’m a cafetière. ' ),
48
- ]],
45
+ 'two comments ' => [
46
+ [
47
+ new Comment ('I’m a teapot. ' ),
48
+ new Comment ('I’m a cafetière. ' ),
49
+ ],
50
+ ],
49
51
];
50
52
}
51
53
@@ -87,10 +89,12 @@ public function provideAlternativeCommentArray(): array
87
89
return [
88
90
'no comment ' => [[]],
89
91
'one comment ' => [[new Comment ('Can I eat it with my hands? ' )]],
90
- 'two comments ' => [[
91
- new Comment ('I’m a beer barrel. ' ),
92
- new Comment ('I’m a vineyard. ' ),
93
- ]],
92
+ 'two comments ' => [
93
+ [
94
+ new Comment ('I’m a beer barrel. ' ),
95
+ new Comment ('I’m a vineyard. ' ),
96
+ ],
97
+ ],
94
98
];
95
99
}
96
100
@@ -110,22 +114,22 @@ public function provideAlternativeNonemptyCommentArray(): array
110
114
* This provider crosses two comment arrays (0, 1 or 2 comments) with different comments,
111
115
* so that all combinations can be tested.
112
116
*
113
- * @return array <non-empty-string, array{0: list<Comment>, 1: list<Comment>}>
117
+ * @return DataProvider <non-empty-string, array{0: list<Comment>, 1: list<Comment>}>
114
118
*/
115
- public function provideTwoDistinctCommentArrays (): array
119
+ public function provideTwoDistinctCommentArrays (): DataProvider
116
120
{
117
- return DataProviders ::cross ($ this ->provideCommentArray (), $ this ->provideAlternativeCommentArray ());
121
+ return DataProvider ::cross ($ this ->provideCommentArray (), $ this ->provideAlternativeCommentArray ());
118
122
}
119
123
120
124
/**
121
- * @return array <non-empty-string, array{0: list<Comment>, 1: non-empty-list<Comment>}>
125
+ * @return DataProvider <non-empty-string, array{0: list<Comment>, 1: non-empty-list<Comment>}>
122
126
*/
123
- public function provideTwoDistinctCommentArraysWithSecondNonempty (): array
127
+ public function provideTwoDistinctCommentArraysWithSecondNonempty (): DataProvider
124
128
{
125
- return DataProviders ::cross ($ this ->provideCommentArray (), $ this ->provideAlternativeNonemptyCommentArray ());
129
+ return DataProvider ::cross ($ this ->provideCommentArray (), $ this ->provideAlternativeNonemptyCommentArray ());
126
130
}
127
131
128
- private static function createContainsContstraint (Comment $ comment ): TraversableContains
132
+ private static function createContainsConstraint (Comment $ comment ): TraversableContains
129
133
{
130
134
return new TraversableContains ($ comment );
131
135
}
@@ -135,9 +139,9 @@ private static function createContainsContstraint(Comment $comment): Traversable
135
139
*
136
140
* @return non-empty-list<TraversableContains>
137
141
*/
138
- private static function createContainsContstraints (array $ comments ): array
142
+ private static function createContainsConstraints (array $ comments ): array
139
143
{
140
- return \array_map ([self ::class, 'createContainsContstraint ' ], $ comments );
144
+ return \array_map ([self ::class, 'createContainsConstraint ' ], $ comments );
141
145
}
142
146
143
147
/**
@@ -156,7 +160,7 @@ public function addCommentsKeepsOriginalComments(array $commentsToAdd, array $or
156
160
157
161
self ::assertThat (
158
162
$ this ->subject ->getComments (),
159
- LogicalAnd::fromConstraints (...self ::createContainsContstraints ($ originalComments ))
163
+ LogicalAnd::fromConstraints (...self ::createContainsConstraints ($ originalComments ))
160
164
);
161
165
}
162
166
@@ -176,7 +180,7 @@ public function addCommentsAfterCommentsSetAddsCommentsProvided(array $originalC
176
180
177
181
self ::assertThat (
178
182
$ this ->subject ->getComments (),
179
- LogicalAnd::fromConstraints (...self ::createContainsContstraints ($ commentsToAdd ))
183
+ LogicalAnd::fromConstraints (...self ::createContainsConstraints ($ commentsToAdd ))
180
184
);
181
185
}
182
186
0 commit comments