-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "::class" in the Pimple test suite
- Loading branch information
Showing
2 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
|
||
use PHPUnit\Framework\TestCase; | ||
use PimpleCopy\Pimple\Container; | ||
use tests\PimpleCopy\Pimple\Fixtures\Service; | ||
|
||
/** | ||
* @author Dominik Zogg <[email protected]> | ||
|
@@ -44,13 +45,13 @@ public function testProvider() | |
$pimple_service_provider->register($pimple); | ||
|
||
$this->assertEquals('value', $pimple['param']); | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $pimple['service']); | ||
$this->assertInstanceOf(Service::class, $pimple['service']); | ||
|
||
$service_one = $pimple['factory']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
|
||
$service_two = $pimple['factory']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
|
||
$this->assertNotSame($service_one, $service_two); | ||
} | ||
|
@@ -66,13 +67,13 @@ public function testProviderWithRegisterMethod() | |
$this->assertEquals('value', $pimple['param']); | ||
$this->assertEquals('anotherValue', $pimple['anotherParameter']); | ||
|
||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $pimple['service']); | ||
$this->assertInstanceOf(Service::class, $pimple['service']); | ||
|
||
$service_one = $pimple['factory']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
|
||
$service_two = $pimple['factory']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
|
||
$this->assertNotSame($service_one, $service_two); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,9 @@ | |
use PHPUnit\Framework\TestCase; | ||
use PimpleCopy\Pimple\Container; | ||
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException; | ||
use tests\PimpleCopy\Pimple\Fixtures\Service; | ||
use PimpleCopy\Pimple\ServiceProviderInterface; | ||
use tests\PimpleCopy\Pimple\Fixtures\NonInvokable; | ||
|
||
/** | ||
* @author Igor Wiedler <[email protected]> | ||
|
@@ -54,7 +57,7 @@ public function testWithClosure() | |
return new Fixtures\Service(); | ||
}; | ||
|
||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $pimple['service']); | ||
$this->assertInstanceOf(Service::class, $pimple['service']); | ||
} | ||
|
||
public function testServicesShouldBeDifferent() | ||
|
@@ -65,10 +68,10 @@ public function testServicesShouldBeDifferent() | |
}); | ||
|
||
$service_one = $pimple['service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
|
||
$service_two = $pimple['service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
|
||
$this->assertNotSame($service_one, $service_two); | ||
} | ||
|
@@ -149,10 +152,10 @@ public function testShare($service) | |
$pimple['shared_service'] = $service; | ||
|
||
$service_one = $pimple['shared_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
|
||
$service_two = $pimple['shared_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
|
||
$this->assertSame($service_one, $service_two); | ||
} | ||
|
@@ -194,7 +197,7 @@ public function testRawHonorsNullValues() | |
public function testFluentRegister() | ||
{ | ||
$pimple = new Container(); | ||
$serviceProviderMock = m::mock('PimpleCopy\Pimple\ServiceProviderInterface'); | ||
$serviceProviderMock = m::mock(ServiceProviderInterface::class); | ||
$serviceProviderMock->shouldReceive('register'); | ||
|
||
$this->assertSame($pimple, $pimple->register($serviceProviderMock)); | ||
|
@@ -224,17 +227,17 @@ public function testExtend($service) | |
|
||
$pimple->extend('shared_service', $service); | ||
$service_one = $pimple['shared_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
$service_two = $pimple['shared_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
$this->assertSame($service_one, $service_two); | ||
$this->assertSame($service_one->value, $service_two->value); | ||
|
||
$pimple->extend('factory_service', $service); | ||
$service_one = $pimple['factory_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_one); | ||
$this->assertInstanceOf(Service::class, $service_one); | ||
$service_two = $pimple['factory_service']; | ||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $service_two); | ||
$this->assertInstanceOf(Service::class, $service_two); | ||
$this->assertNotSame($service_one, $service_two); | ||
$this->assertNotSame($service_one->value, $service_two->value); | ||
} | ||
|
@@ -288,7 +291,7 @@ public function settingAnInvokableObjectShouldTreatItAsFactory() | |
$pimple = new Container(); | ||
$pimple['invokable'] = new Fixtures\Invokable(); | ||
|
||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\Service', $pimple['invokable']); | ||
$this->assertInstanceOf(Service::class, $pimple['invokable']); | ||
} | ||
|
||
/** @test */ | ||
|
@@ -297,7 +300,7 @@ public function settingNonInvokableObjectShouldTreatItAsParameter() | |
$pimple = new Container(); | ||
$pimple['non_invokable'] = new Fixtures\NonInvokable(); | ||
|
||
$this->assertInstanceOf('tests\PimpleCopy\Pimple\Fixtures\NonInvokable', $pimple['non_invokable']); | ||
$this->assertInstanceOf(NonInvokable::class, $pimple['non_invokable']); | ||
} | ||
|
||
/** | ||
|