Skip to content

Commit cd8c6a2

Browse files
OskarStarknicolas-grekas
authored andcommitted
Use createMock() and use import instead of FQCN
1 parent 4df3400 commit cd8c6a2

File tree

2 files changed

+65
-57
lines changed

2 files changed

+65
-57
lines changed

Tests/Debug/OptionsResolverIntrospectorTest.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
16+
use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
17+
use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
1618
use Symfony\Component\OptionsResolver\Options;
1719
use Symfony\Component\OptionsResolver\OptionsResolver;
1820

@@ -38,7 +40,7 @@ public function testGetDefaultNull()
3840

3941
public function testGetDefaultThrowsOnNoConfiguredValue()
4042
{
41-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
43+
$this->expectException(NoConfigurationException::class);
4244
$this->expectExceptionMessage('No default value was set for the "foo" option.');
4345
$resolver = new OptionsResolver();
4446
$resolver->setDefined($option = 'foo');
@@ -49,7 +51,7 @@ public function testGetDefaultThrowsOnNoConfiguredValue()
4951

5052
public function testGetDefaultThrowsOnNotDefinedOption()
5153
{
52-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
54+
$this->expectException(UndefinedOptionsException::class);
5355
$this->expectExceptionMessage('The option "foo" does not exist.');
5456
$resolver = new OptionsResolver();
5557

@@ -69,7 +71,7 @@ public function testGetLazyClosures()
6971

7072
public function testGetLazyClosuresThrowsOnNoConfiguredValue()
7173
{
72-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
74+
$this->expectException(NoConfigurationException::class);
7375
$this->expectExceptionMessage('No lazy closures were set for the "foo" option.');
7476
$resolver = new OptionsResolver();
7577
$resolver->setDefined($option = 'foo');
@@ -80,7 +82,7 @@ public function testGetLazyClosuresThrowsOnNoConfiguredValue()
8082

8183
public function testGetLazyClosuresThrowsOnNotDefinedOption()
8284
{
83-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
85+
$this->expectException(UndefinedOptionsException::class);
8486
$this->expectExceptionMessage('The option "foo" does not exist.');
8587
$resolver = new OptionsResolver();
8688

@@ -100,7 +102,7 @@ public function testGetAllowedTypes()
100102

101103
public function testGetAllowedTypesThrowsOnNoConfiguredValue()
102104
{
103-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
105+
$this->expectException(NoConfigurationException::class);
104106
$this->expectExceptionMessage('No allowed types were set for the "foo" option.');
105107
$resolver = new OptionsResolver();
106108
$resolver->setDefined($option = 'foo');
@@ -111,7 +113,7 @@ public function testGetAllowedTypesThrowsOnNoConfiguredValue()
111113

112114
public function testGetAllowedTypesThrowsOnNotDefinedOption()
113115
{
114-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
116+
$this->expectException(UndefinedOptionsException::class);
115117
$this->expectExceptionMessage('The option "foo" does not exist.');
116118
$resolver = new OptionsResolver();
117119

@@ -131,7 +133,7 @@ public function testGetAllowedValues()
131133

132134
public function testGetAllowedValuesThrowsOnNoConfiguredValue()
133135
{
134-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
136+
$this->expectException(NoConfigurationException::class);
135137
$this->expectExceptionMessage('No allowed values were set for the "foo" option.');
136138
$resolver = new OptionsResolver();
137139
$resolver->setDefined($option = 'foo');
@@ -142,7 +144,7 @@ public function testGetAllowedValuesThrowsOnNoConfiguredValue()
142144

143145
public function testGetAllowedValuesThrowsOnNotDefinedOption()
144146
{
145-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
147+
$this->expectException(UndefinedOptionsException::class);
146148
$this->expectExceptionMessage('The option "foo" does not exist.');
147149
$resolver = new OptionsResolver();
148150

@@ -162,7 +164,7 @@ public function testGetNormalizer()
162164

163165
public function testGetNormalizerThrowsOnNoConfiguredValue()
164166
{
165-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
167+
$this->expectException(NoConfigurationException::class);
166168
$this->expectExceptionMessage('No normalizer was set for the "foo" option.');
167169
$resolver = new OptionsResolver();
168170
$resolver->setDefined($option = 'foo');
@@ -173,7 +175,7 @@ public function testGetNormalizerThrowsOnNoConfiguredValue()
173175

174176
public function testGetNormalizerThrowsOnNotDefinedOption()
175177
{
176-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
178+
$this->expectException(UndefinedOptionsException::class);
177179
$this->expectExceptionMessage('The option "foo" does not exist.');
178180
$resolver = new OptionsResolver();
179181

@@ -194,7 +196,7 @@ public function testGetNormalizers()
194196

195197
public function testGetNormalizersThrowsOnNoConfiguredValue()
196198
{
197-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
199+
$this->expectException(NoConfigurationException::class);
198200
$this->expectExceptionMessage('No normalizer was set for the "foo" option.');
199201
$resolver = new OptionsResolver();
200202
$resolver->setDefined('foo');
@@ -205,7 +207,7 @@ public function testGetNormalizersThrowsOnNoConfiguredValue()
205207

206208
public function testGetNormalizersThrowsOnNotDefinedOption()
207209
{
208-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
210+
$this->expectException(UndefinedOptionsException::class);
209211
$this->expectExceptionMessage('The option "foo" does not exist.');
210212
$resolver = new OptionsResolver();
211213

@@ -235,7 +237,7 @@ public function testGetClosureDeprecationMessage()
235237

236238
public function testGetDeprecationMessageThrowsOnNoConfiguredValue()
237239
{
238-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\NoConfigurationException::class);
240+
$this->expectException(NoConfigurationException::class);
239241
$this->expectExceptionMessage('No deprecation was set for the "foo" option.');
240242
$resolver = new OptionsResolver();
241243
$resolver->setDefined('foo');
@@ -246,7 +248,7 @@ public function testGetDeprecationMessageThrowsOnNoConfiguredValue()
246248

247249
public function testGetDeprecationMessageThrowsOnNotDefinedOption()
248250
{
249-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException::class);
251+
$this->expectException(UndefinedOptionsException::class);
250252
$this->expectExceptionMessage('The option "foo" does not exist.');
251253
$resolver = new OptionsResolver();
252254

0 commit comments

Comments
 (0)