Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit 6280454

Browse files
committed
Changed self:: to $this-> for expectException* methods
These methods are not static.
1 parent 226a968 commit 6280454

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

test/AbstractFactory/ConfigAbstractFactoryTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ public function testExceptsWhenConfigNotSet()
184184
{
185185
$abstractFactory = new ConfigAbstractFactory();
186186
$serviceManager = new ServiceManager();
187-
self::expectException(ServiceNotCreatedException::class);
188-
self::expectExceptionMessage('Cannot find a config array in the container');
187+
$this->expectException(ServiceNotCreatedException::class);
188+
$this->expectExceptionMessage('Cannot find a config array in the container');
189189

190190
$abstractFactory($serviceManager, 'Dirk_Gently');
191191
}
@@ -195,8 +195,8 @@ public function testExceptsWhenConfigKeyNotSet()
195195
$abstractFactory = new ConfigAbstractFactory();
196196
$serviceManager = new ServiceManager();
197197
$serviceManager->setService('config', []);
198-
self::expectException(ServiceNotCreatedException::class);
199-
self::expectExceptionMessage('Cannot find a `' . ConfigAbstractFactory::class . '` key in the config array');
198+
$this->expectException(ServiceNotCreatedException::class);
199+
$this->expectExceptionMessage('Cannot find a `' . ConfigAbstractFactory::class . '` key in the config array');
200200

201201
$abstractFactory($serviceManager, 'Dirk_Gently');
202202
}
@@ -206,8 +206,8 @@ public function testExceptsWhenConfigIsNotArray()
206206
$abstractFactory = new ConfigAbstractFactory();
207207
$serviceManager = new ServiceManager();
208208
$serviceManager->setService('config', 'Holistic');
209-
self::expectException(ServiceNotCreatedException::class);
210-
self::expectExceptionMessage('Config must be an array');
209+
$this->expectException(ServiceNotCreatedException::class);
210+
$this->expectExceptionMessage('Config must be an array');
211211

212212
$abstractFactory($serviceManager, 'Dirk_Gently');
213213
}
@@ -222,8 +222,8 @@ public function testExceptsWhenServiceConfigIsNotArray()
222222
ConfigAbstractFactory::class => 'Detective_Agency'
223223
]
224224
);
225-
self::expectException(ServiceNotCreatedException::class);
226-
self::expectExceptionMessage('Dependencies config must exist and be an array');
225+
$this->expectException(ServiceNotCreatedException::class);
226+
$this->expectExceptionMessage('Dependencies config must exist and be an array');
227227

228228
$abstractFactory($serviceManager, 'Dirk_Gently');
229229
}
@@ -238,8 +238,8 @@ public function testExceptsWhenServiceConfigDoesNotExist()
238238
ConfigAbstractFactory::class => [],
239239
]
240240
);
241-
self::expectException(ServiceNotCreatedException::class);
242-
self::expectExceptionMessage('Dependencies config must exist and be an array');
241+
$this->expectException(ServiceNotCreatedException::class);
242+
$this->expectExceptionMessage('Dependencies config must exist and be an array');
243243

244244
$abstractFactory($serviceManager, 'Dirk_Gently');
245245
}
@@ -256,8 +256,8 @@ public function testExceptsWhenServiceConfigForRequestedNameIsNotArray()
256256
],
257257
]
258258
);
259-
self::expectException(ServiceNotCreatedException::class);
260-
self::expectExceptionMessage('Dependencies config must exist and be an array');
259+
$this->expectException(ServiceNotCreatedException::class);
260+
$this->expectExceptionMessage('Dependencies config must exist and be an array');
261261

262262
$abstractFactory($serviceManager, 'Dirk_Gently');
263263
}
@@ -279,8 +279,8 @@ public function testExceptsWhenServiceConfigForRequestedNameIsNotArrayOfStrings(
279279
],
280280
]
281281
);
282-
self::expectException(ServiceNotCreatedException::class);
283-
self::expectExceptionMessage(
282+
$this->expectException(ServiceNotCreatedException::class);
283+
$this->expectExceptionMessage(
284284
'Service message must be an array of strings, ["string","string","string","integer"] given'
285285
);
286286

test/Tool/ConfigDumperTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public function setUp()
3636

3737
public function testCreateDependencyConfigExceptsIfClassNameIsNotString()
3838
{
39-
self::expectException(InvalidArgumentException::class);
40-
self::expectExceptionMessage('Class name must be a string, integer given');
39+
$this->expectException(InvalidArgumentException::class);
40+
$this->expectExceptionMessage('Class name must be a string, integer given');
4141
$this->dumper->createDependencyConfig([], 42);
4242
}
4343

4444
public function testCreateDependencyConfigExceptsIfClassDoesNotExist()
4545
{
4646
$className = 'Dirk\Gentley\Holistic\Detective\Agency';
47-
self::expectException(InvalidArgumentException::class);
48-
self::expectExceptionMessage('Cannot find class or interface with name ' . $className);
47+
$this->expectException(InvalidArgumentException::class);
48+
$this->expectExceptionMessage('Cannot find class or interface with name ' . $className);
4949
$this->dumper->createDependencyConfig([], $className);
5050
}
5151

@@ -92,8 +92,8 @@ public function testCreateDependencyConfigClassWithoutConstructorHandlesAsInvoka
9292

9393
public function testCreateDependencyConfigWithoutTypeHintedParameterExcepts()
9494
{
95-
self::expectException(InvalidArgumentException::class);
96-
self::expectExceptionMessage(
95+
$this->expectException(InvalidArgumentException::class);
96+
$this->expectExceptionMessage(
9797
'Cannot create config for constructor argument "aName", '
9898
. 'it has no type hint, or non-class/interface type hint'
9999
);
@@ -105,8 +105,8 @@ public function testCreateDependencyConfigWithoutTypeHintedParameterExcepts()
105105

106106
public function testCreateDependencyConfigWithContainerAndNoServiceWithoutTypeHintedParameterExcepts()
107107
{
108-
self::expectException(InvalidArgumentException::class);
109-
self::expectExceptionMessage(
108+
$this->expectException(InvalidArgumentException::class);
109+
$this->expectExceptionMessage(
110110
'Cannot create config for constructor argument "aName", '
111111
. 'it has no type hint, or non-class/interface type hint'
112112
);
@@ -209,16 +209,16 @@ public function testCreateDependencyConfigWorksWithMultipleDependenciesOfSameTyp
209209

210210
public function testCreateFactoryMappingsExceptsIfClassNameIsNotString()
211211
{
212-
self::expectException(InvalidArgumentException::class);
213-
self::expectExceptionMessage('Class name must be a string, integer given');
212+
$this->expectException(InvalidArgumentException::class);
213+
$this->expectExceptionMessage('Class name must be a string, integer given');
214214
$this->dumper->createFactoryMappings([], 42);
215215
}
216216

217217
public function testCreateFactoryMappingsExceptsIfClassDoesNotExist()
218218
{
219219
$className = 'Dirk\Gentley\Holistic\Detective\Agency';
220-
self::expectException(InvalidArgumentException::class);
221-
self::expectExceptionMessage('Cannot find class or interface with name ' . $className);
220+
$this->expectException(InvalidArgumentException::class);
221+
$this->expectExceptionMessage('Cannot find class or interface with name ' . $className);
222222
$this->dumper->createFactoryMappings([], $className);
223223
}
224224

@@ -265,8 +265,8 @@ public function testCreateFactoryMappingsFromConfigReturnsIfNoConfigKey()
265265

266266
public function testCreateFactoryMappingsFromConfigExceptsWhenConfigNotArray()
267267
{
268-
self::expectException(InvalidArgumentException::class);
269-
self::expectExceptionMessage(
268+
$this->expectException(InvalidArgumentException::class);
269+
$this->expectExceptionMessage(
270270
'Config key for ' . ConfigAbstractFactory::class . ' should be an array, boolean given'
271271
);
272272

0 commit comments

Comments
 (0)