22
33namespace Terraformers \KeysForCache \Tests \Scenarios ;
44
5+ use PHPUnit \Framework \Attributes \DataProvider ;
56use SilverStripe \Core \Injector \Injector ;
67use SilverStripe \Dev \SapphireTest ;
78use SilverStripe \ORM \DataObject ;
@@ -53,9 +54,7 @@ class ExtendedCaresTest extends SapphireTest
5354 PolymorphicCaredHasOne::class,
5455 ];
5556
56- /**
57- * @dataProvider readingModesWithSaveMethods
58- */
57+ #[DataProvider('readingModesWithSaveMethods ' )]
5958 public function testCaresPureHasOne (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
6059 {
6160 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -75,9 +74,7 @@ public function testCaresPureHasOne(string $readingMode, string $saveMethod, boo
7574 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
7675 }
7776
78- /**
79- * @dataProvider readingModesWithSaveMethods
80- */
77+ #[DataProvider('readingModesWithSaveMethods ' )]
8178 public function testCaresBelongsTo (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
8279 {
8380 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -97,9 +94,7 @@ public function testCaresBelongsTo(string $readingMode, string $saveMethod, bool
9794 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
9895 }
9996
100- /**
101- * @dataProvider readingModesWithSaveMethods
102- */
97+ #[DataProvider('readingModesWithSaveMethods ' )]
10398 public function testCaresHasOne (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
10499 {
105100 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -119,9 +114,7 @@ public function testCaresHasOne(string $readingMode, string $saveMethod, bool $e
119114 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
120115 }
121116
122- /**
123- * @dataProvider readingModesWithSaveMethods
124- */
117+ #[DataProvider('readingModesWithSaveMethods ' )]
125118 public function testPolymorphicCaresHasOne (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
126119 {
127120 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -141,9 +134,7 @@ public function testPolymorphicCaresHasOne(string $readingMode, string $saveMeth
141134 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
142135 }
143136
144- /**
145- * @dataProvider readingModesWithSaveMethods
146- */
137+ #[DataProvider('readingModesWithSaveMethods ' )]
147138 public function testExtendedPolymorphicCaresHasOne (
148139 string $ readingMode ,
149140 string $ saveMethod ,
@@ -166,9 +157,7 @@ public function testExtendedPolymorphicCaresHasOne(
166157 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
167158 }
168159
169- /**
170- * @dataProvider readingModesWithSaveMethods
171- */
160+ #[DataProvider('readingModesWithSaveMethods ' )]
172161 public function testCaresHasMany (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
173162 {
174163 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -184,9 +173,7 @@ public function testCaresHasMany(string $readingMode, string $saveMethod, bool $
184173 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
185174 }
186175
187- /**
188- * @dataProvider readingModesWithSaveMethods
189- */
176+ #[DataProvider('readingModesWithSaveMethods ' )]
190177 public function testPolymorphicCaresHasMany (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
191178 {
192179 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -202,9 +189,7 @@ public function testPolymorphicCaresHasMany(string $readingMode, string $saveMet
202189 $ this ->assertCacheKeyChanges ($ page , $ model , $ readingMode , $ saveMethod , $ expectKeyChange );
203190 }
204191
205- /**
206- * @dataProvider readingModesWithSaveMethods
207- */
192+ #[DataProvider('readingModesWithSaveMethods ' )]
208193 public function testExtendedPolymorphicCaresHasMany (
209194 string $ readingMode ,
210195 string $ saveMethod ,
@@ -225,9 +210,8 @@ public function testExtendedPolymorphicCaresHasMany(
225210
226211 /**
227212 * Testing that Base relationships work when the explicit class is used in the relationship
228- *
229- * @dataProvider readingModesWithSaveMethods
230213 */
214+ #[DataProvider('readingModesWithSaveMethods ' )]
231215 public function testBaseCaredHasOne (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
232216 {
233217 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -245,9 +229,8 @@ public function testBaseCaredHasOne(string $readingMode, string $saveMethod, boo
245229
246230 /**
247231 * Testing that Base relationships work when the explicit class is used in the relationship
248- *
249- * @dataProvider readingModesWithSaveMethods
250232 */
233+ #[DataProvider('readingModesWithSaveMethods ' )]
251234 public function testBaseCaredHasMany (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
252235 {
253236 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -265,9 +248,8 @@ public function testBaseCaredHasMany(string $readingMode, string $saveMethod, bo
265248
266249 /**
267250 * Now testing that a relationship to a Base class still works when the related object is an extended class
268- *
269- * @dataProvider readingModesWithSaveMethods
270251 */
252+ #[DataProvider('readingModesWithSaveMethods ' )]
271253 public function testExtendedCaredHasOne (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
272254 {
273255 // Updates are processed as part of scaffold, so we need to flush before we kick off
@@ -287,9 +269,8 @@ public function testExtendedCaredHasOne(string $readingMode, string $saveMethod,
287269
288270 /**
289271 * Now testing that a relationship to a Base class still works when the related object is an extended class
290- *
291- * @dataProvider readingModesWithSaveMethods
292272 */
273+ #[DataProvider('readingModesWithSaveMethods ' )]
293274 public function testExtendedCaredHasMany (string $ readingMode , string $ saveMethod , bool $ expectKeyChange ): void
294275 {
295276 // Updates are processed as part of scaffold, so we need to flush before we kick off
0 commit comments