Skip to content

Commit acf9dd2

Browse files
committed
Rector + CS
1 parent dd7766f commit acf9dd2

11 files changed

Lines changed: 27 additions & 75 deletions

tests/CodefogTagsBundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PHPUnit\Framework\TestCase;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111

12-
class CodefogTagsBundleTest extends TestCase
12+
final class CodefogTagsBundleTest extends TestCase
1313
{
1414
public function testInstantiation(): void
1515
{

tests/ContaoManager/PluginTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
1313
use PHPUnit\Framework\TestCase;
1414

15-
class PluginTest extends TestCase
15+
final class PluginTest extends TestCase
1616
{
1717
public function testGetBundles(): void
1818
{
1919
$plugin = new Plugin();
20-
$bundles = $plugin->getBundles($this->createMock(ParserInterface::class));
20+
$bundles = $plugin->getBundles($this->createStub(ParserInterface::class));
2121

2222
/** @var BundleConfig $config */
2323
$config = $bundles[0];

tests/DependencyInjection/CodefogTagsExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PHPUnit\Framework\TestCase;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111

12-
class CodefogTagsExtensionTest extends TestCase
12+
final class CodefogTagsExtensionTest extends TestCase
1313
{
1414
public function testLoad(): void
1515
{

tests/DependencyInjection/Compiler/ManagerPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Symfony\Component\DependencyInjection\Definition;
1111
use Symfony\Component\DependencyInjection\Reference;
1212

13-
class ManagerPassTest extends TestCase
13+
final class ManagerPassTest extends TestCase
1414
{
1515
public function testProcess(): void
1616
{

tests/EventListener/InsertTagsListenerTest.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/EventListener/TagManagerListenerTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\RequestStack;
1616

17-
class TagManagerListenerTest extends TestCase
17+
final class TagManagerListenerTest extends TestCase
1818
{
1919
public function testOnLoadDataContainer(): void
2020
{
@@ -90,6 +90,7 @@ public function testOnFieldSaveCallback(): void
9090

9191
$dataContainer = $this->createMock(DataContainer::class);
9292
$dataContainer
93+
->expects($this->exactly(2))
9394
->method('__get')
9495
->willReturnMap([
9596
['table', 'tl_table'],
@@ -110,14 +111,15 @@ public function testOnFieldSaveCallbackManagerUnsupported(): void
110111

111112
$dataContainer = $this->createMock(DataContainer::class);
112113
$dataContainer
114+
->expects($this->exactly(2))
113115
->method('__get')
114116
->willReturnMap([
115117
['table', 'tl_table'],
116118
['field', 'field'],
117119
])
118120
;
119121

120-
$listener = $this->mockListener($this->createMock(ManagerInterface::class));
122+
$listener = $this->mockListener($this->createStub(ManagerInterface::class));
121123

122124
$this->assertSame('foobar', $listener->onFieldSaveCallback('foobar', $dataContainer));
123125
}
@@ -132,6 +134,7 @@ public function testOnOptionsCallback(): void
132134

133135
$dataContainer = $this->createMock(DataContainer::class);
134136
$dataContainer
137+
->expects($this->exactly(2))
135138
->method('__get')
136139
->willReturnMap([
137140
['table', 'tl_table'],
@@ -152,14 +155,15 @@ public function testOnOptionsCallbackManagerUnsupported(): void
152155

153156
$dataContainer = $this->createMock(DataContainer::class);
154157
$dataContainer
158+
->expects($this->exactly(2))
155159
->method('__get')
156160
->willReturnMap([
157161
['table', 'tl_table'],
158162
['field', 'field'],
159163
])
160164
;
161165

162-
$listener = $this->mockListener($this->createMock(ManagerInterface::class));
166+
$listener = $this->mockListener($this->createStub(ManagerInterface::class));
163167

164168
$this->assertSame([], $listener->onOptionsCallback($dataContainer));
165169
}

tests/Finder/SourceCriteriaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Codefog\TagsBundle\Tag;
99
use PHPUnit\Framework\TestCase;
1010

11-
class SourceCriteriaTest extends TestCase
11+
final class SourceCriteriaTest extends TestCase
1212
{
1313
public function testAll(): void
1414
{

tests/Finder/TagCriteriaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Codefog\TagsBundle\Finder\TagCriteria;
88
use PHPUnit\Framework\TestCase;
99

10-
class TagCriteriaTest extends TestCase
10+
final class TagCriteriaTest extends TestCase
1111
{
1212
public function testAll(): void
1313
{

tests/Manager/DefaultManagerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Contao\StringUtil;
1515
use 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'],

tests/ManagerRegistryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
use Codefog\TagsBundle\ManagerRegistry;
1010
use PHPUnit\Framework\TestCase;
1111

12-
class ManagerRegistryTest extends TestCase
12+
final class ManagerRegistryTest extends TestCase
1313
{
1414
public function testAddManager(): void
1515
{
16-
$managerMock = $this->createMock(ManagerInterface::class);
16+
$managerMock = $this->createStub(ManagerInterface::class);
1717

1818
$registry = $this->mockRegistry();
1919
$registry->add($managerMock, 'foobar');
@@ -31,8 +31,8 @@ public function testManagerNotExists(): void
3131

3232
public function testGetAliases(): void
3333
{
34-
$manager1Mock = $this->createMock(ManagerInterface::class);
35-
$manager2Mock = $this->createMock(DefaultManager::class);
34+
$manager1Mock = $this->createStub(ManagerInterface::class);
35+
$manager2Mock = $this->createStub(DefaultManager::class);
3636

3737
$registry = $this->mockRegistry();
3838
$registry->add($manager1Mock, 'foobar');

0 commit comments

Comments
 (0)