ContainerTest

Extends \PHPUnit\Framework\TestCase

Tests for Container object

package

Kocuj\Di\Tests\Container

Methods

Provider for testing standard and shared services

addCallMethodProvider() : array

Response

array

Data for testing standard and shared services

Provider for testing adding and checking standard and shared services

addHasCheckTypeProvider() : array

Response

array

Data for testing adding and checking standard and shared services

Provider for testing cloning container

cloneProvider() : array

Response

array

Data for testing cloning container

Provider for services types

servicesTypesProvider() : array

Response

array

Data for services types

Setup tests

setUp() 

Testing adding standard or shared service

testAdd(\Kocuj\Di\Service\ServiceType $serviceType, string $serviceId, string $decoratedServiceId) 
dataProvider

addHasCheckTypeProvider

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

$serviceId

string

Service identifier

$decoratedServiceId

string

Decorated service identifier

Testing service which already exists

testAddAlreadyExists(\Kocuj\Di\Service\ServiceType $serviceType) 
dataProvider

servicesTypesProvider

expectedException

\Kocuj\Di\Container\Exception

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

Testing standard or shared service

testAddCallMethod(\Kocuj\Di\Service\ServiceType $serviceType, string $serviceId, string $decoratedServiceId, string $callMethod) 
dataProvider

addCallMethodProvider

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

$serviceId

string

Service identifier

$decoratedServiceId

string

Decorated service identifier

$callMethod

string

Method to call to get service

Testing wrong service identifier to get after creating standard or shared service

testAddWithWrongGet(\Kocuj\Di\Service\ServiceType $serviceType) 
dataProvider

servicesTypesProvider

expectedException

\Kocuj\Di\Container\NotFoundException

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

Testing calling with arguments

testCallMethodWithArguments(\Kocuj\Di\Service\ServiceType $serviceType) 
dataProvider

servicesTypesProvider

expectedException

\Kocuj\Di\Container\Exception

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

Testing checking type of standard or shared service

testCheckType(\Kocuj\Di\Service\ServiceType $serviceType, string $serviceId, string $decoratedServiceId) 
dataProvider

addHasCheckTypeProvider

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

$serviceId

string

Service identifier

$decoratedServiceId

string

Decorated service identifier

Testing cloning container

testClone(\Kocuj\Di\Service\ServiceType $serviceType, string $serviceId, string $decoratedServiceId) 
dataProvider

cloneProvider

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

$serviceId

string

Service identifier

$decoratedServiceId

string

Decorated service identifier

Testing get type

testGetType(\Kocuj\Di\Service\ServiceType $serviceType) 
dataProvider

servicesTypesProvider

expectedException

\PHPUnit\Framework\Error\Error

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

Testing checking standard or shared service

testHas(\Kocuj\Di\Service\ServiceType $serviceType, string $serviceId, string $decoratedServiceId) 
dataProvider

addHasCheckTypeProvider

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

$serviceId

string

Service identifier

$decoratedServiceId

string

Decorated service identifier

Testing calling wrong method

testWrongCallMethod(\Kocuj\Di\Service\ServiceType $serviceType) 
dataProvider

servicesTypesProvider

expectedException

\PHPUnit\Framework\Error\Error

Arguments

$serviceType

\Kocuj\Di\Service\ServiceType

Service type

Properties

Service identifier decorator

serviceIdDecorator : \Kocuj\Di\ServiceIdDecorator\ServiceIdDecoratorInterface

Fake service

fakeService : object
var

Type(s)

object

Service

service : \Kocuj\Di\Service\ServiceInterface

Service factory

serviceFactory : \Kocuj\Di\Service\ServiceFactoryInterface