|
2 | 2 |
|
3 | 3 | use AlgoYounes\Bindify\Attributes\BindType; |
4 | 4 | use AlgoYounes\Bindify\Contexts\BindContext; |
5 | | -use Workbench\App\AlternativeImplementationService; |
6 | 5 | use Workbench\App\Contracts\DefaultBindTypeContract; |
7 | | -use Workbench\App\Contracts\InvalidClassBindingsContract; |
8 | | -use Workbench\App\Contracts\MultiBindContract; |
9 | 6 | use Workbench\App\Contracts\MultipleAttributesContract; |
10 | 7 | use Workbench\App\Contracts\NoAttributeContract; |
11 | 8 | use Workbench\App\Contracts\SingletonBindingContract; |
12 | | -use Workbench\App\DefaultImplementationService; |
| 9 | +use Workbench\App\DefaultImplementationContract; |
13 | 10 |
|
14 | 11 | it('returns a binding from the interface attribute with the default type', function () { |
15 | 12 | $context = BindContext::create( |
16 | 13 | DefaultBindTypeContract::class, |
17 | | - DefaultImplementationService::class, |
| 14 | + DefaultImplementationContract::class, |
18 | 15 | BindType::Transient |
19 | 16 | ); |
20 | 17 |
|
|
26 | 23 | it('returns a binding from the interface attribute with the singleton type', function () { |
27 | 24 | $context = BindContext::create( |
28 | 25 | SingletonBindingContract::class, |
29 | | - DefaultImplementationService::class, |
| 26 | + DefaultImplementationContract::class, |
30 | 27 | BindType::Singleton |
31 | 28 | ); |
32 | 29 |
|
|
46 | 43 | it('returns null when the interface has more than one attribute', function () { |
47 | 44 | $this->assertNull($this->attributeResolver->resolve(MultipleAttributesContract::class)); |
48 | 45 | }); |
49 | | - |
50 | | -it('return null when invalid classes binding', function () { |
51 | | - $this->assertNull($this->attributeResolver->resolve(InvalidClassBindingsContract::class)); |
52 | | -}); |
53 | | - |
54 | | -it('binds multiple valid services to the same interface', function () { |
55 | | - /** @var BindContext $binding */ |
56 | | - $binding = $this->attributeResolver->resolve(MultiBindContract::class); |
57 | | - |
58 | | - $expected = BindContext::create( |
59 | | - MultiBindContract::class, |
60 | | - [ |
61 | | - DefaultImplementationService::class, |
62 | | - AlternativeImplementationService::class, |
63 | | - ], |
64 | | - BindType::Transient |
65 | | - ); |
66 | | - |
67 | | - expect($expected) |
68 | | - ->toEqual($binding) |
69 | | - ->and($binding->getConcrete()) |
70 | | - ->toBeArray() |
71 | | - ->toHaveCount(2) |
72 | | - ->and($binding->getConcrete()) |
73 | | - ->toEqual([DefaultImplementationService::class, AlternativeImplementationService::class]); |
74 | | -}); |
0 commit comments