1414use Contao \StringUtil ;
1515use Contao \TestCase \ContaoTestCase ;
1616
17- class DefaultManagerTest extends ContaoTestCase
17+ final class DefaultManagerTest extends ContaoTestCase
1818{
1919 public function testGetAllTags (): void
2020 {
@@ -104,7 +104,7 @@ public function testSaveDcaFieldNewTags(): void
104104 $ tag = new Tag ('bar ' , 'foo ' );
105105 $ manager = $ this ->mockManager (['tl_table.tags ' ], ['findSingle ' => null , 'createTagFromModel ' => $ tag ]);
106106
107- $ value = $ manager ->saveDcaField (serialize (['new-tag ' ]), $ this ->createMock (DataContainer::class));
107+ $ value = $ manager ->saveDcaField (serialize (['new-tag ' ]), $ this ->createStub (DataContainer::class));
108108 $ value = StringUtil::deserialize ($ value , true );
109109
110110 $ this ->assertCount (1 , $ value );
@@ -116,7 +116,7 @@ public function testSaveDcaFieldNoNewTags(): void
116116 $ tag = new Tag ('bar ' , 'foo ' );
117117 $ manager = $ this ->mockManager (['tl_table.tags ' ], ['findSingle ' => $ tag ]);
118118
119- $ value = $ manager ->saveDcaField (serialize (['existing-tag ' ]), $ this ->createMock (DataContainer::class));
119+ $ value = $ manager ->saveDcaField (serialize (['existing-tag ' ]), $ this ->createStub (DataContainer::class));
120120 $ value = StringUtil::deserialize ($ value , true );
121121
122122 $ this ->assertCount (1 , $ value );
@@ -128,7 +128,7 @@ public function testGetFilterOptions(): void
128128 $ tag1 = new Tag ('tag1 ' , 'foo ' );
129129 $ tag2 = new Tag ('tag2 ' , 'bar ' );
130130
131- $ options = $ this ->mockManager (['tl_table.tags ' ], ['findMultiple ' => [$ tag1 , $ tag2 ]])->getFilterOptions ($ this ->createMock (DataContainer::class));
131+ $ options = $ this ->mockManager (['tl_table.tags ' ], ['findMultiple ' => [$ tag1 , $ tag2 ]])->getFilterOptions ($ this ->createStub (DataContainer::class));
132132
133133 $ this ->assertSame (['tag1 ' => 'foo ' , 'tag2 ' => 'bar ' ], $ options );
134134 }
@@ -142,6 +142,7 @@ public function testGetFilterOptionsWithPredefinedTagsSource(): void
142142
143143 $ dataContainer = $ this ->createMock (DataContainer::class);
144144 $ dataContainer
145+ ->expects ($ this ->exactly (2 ))
145146 ->method ('__get ' )
146147 ->willReturnMap ([
147148 ['table ' , 'tl_table ' ],
@@ -158,7 +159,7 @@ public function testGetSourceRecordsCountEmpty(): void
158159 {
159160 $ manager = $ this ->mockManager (['tl_table.tags ' ], ['findSingle ' => null ]);
160161
161- $ count = $ manager ->getSourceRecordsCount (['id ' => 1 ], $ this ->createMock (DataContainer::class));
162+ $ count = $ manager ->getSourceRecordsCount (['id ' => 1 ], $ this ->createStub (DataContainer::class));
162163
163164 $ this ->assertSame (0 , $ count );
164165 }
@@ -168,7 +169,7 @@ public function testGetSourceRecordsCount(): void
168169 $ tag = new Tag ('bar ' , 'foo ' );
169170 $ manager = $ this ->mockManager (['tl_table.tags ' , 'tl_table_2.tags ' ], ['findSingle ' => $ tag ], ['count ' => 3 ]);
170171
171- $ count = $ manager ->getSourceRecordsCount (['id ' => 1 ], $ this ->createMock (DataContainer::class));
172+ $ count = $ manager ->getSourceRecordsCount (['id ' => 1 ], $ this ->createStub (DataContainer::class));
172173
173174 $ this ->assertSame (6 , $ count );
174175 }
@@ -182,6 +183,7 @@ public function testGetSourceRecordsCountWithPredefinedTagsSource(): void
182183
183184 $ dataContainer = $ this ->createMock (DataContainer::class);
184185 $ dataContainer
186+ ->expects ($ this ->exactly (2 ))
185187 ->method ('__get ' )
186188 ->willReturnMap ([
187189 ['table ' , 'tl_table ' ],
0 commit comments