|
2 | 2 |
|
3 | 3 | namespace hiqdev\php\billing\tests\unit\product\Application; |
4 | 4 |
|
| 5 | +use hiqdev\billing\registry\invoice\InvoiceRepresentation; |
| 6 | +use hiqdev\billing\registry\invoice\PaymentRequestRepresentation; |
5 | 7 | use hiqdev\php\billing\product\Application\BillingRegistryService; |
6 | 8 | use hiqdev\php\billing\product\behavior\BehaviorNotFoundException; |
7 | 9 | use hiqdev\php\billing\product\BillingRegistry; |
8 | 10 | use hiqdev\php\billing\product\Exception\AggregateNotFoundException; |
9 | 11 | use hiqdev\php\billing\product\invoice\InvalidRepresentationException; |
| 12 | +use hiqdev\php\billing\product\invoice\RepresentationInterface; |
10 | 13 | use hiqdev\php\billing\product\TariffTypeDefinition; |
11 | 14 | use hiqdev\php\billing\tests\unit\product\behavior\FakeBehavior; |
12 | 15 | use hiqdev\php\billing\tests\unit\product\behavior\TestBehavior; |
@@ -39,6 +42,28 @@ public function testGetAggregateThrowsExceptionWhenNotFound(): void |
39 | 42 | $this->registryService->getAggregate('non-existent-type'); |
40 | 43 | } |
41 | 44 |
|
| 45 | + public function testGetRepresentationsByInterfaceReturnsAllRepresentations(): void |
| 46 | + { |
| 47 | + $tariffType = new DummyTariffType(); |
| 48 | + $tariffTypeDefinition = new TariffTypeDefinition($tariffType); |
| 49 | + |
| 50 | + $tariffTypeDefinition |
| 51 | + ->withPrices() |
| 52 | + ->priceType(Type::anyId('dummy')) |
| 53 | + ->documentRepresentation() |
| 54 | + ->attach(new InvoiceRepresentation("Invoice")) |
| 55 | + ->attach(new PaymentRequestRepresentation("Payment Request")) |
| 56 | + ->end() |
| 57 | + ->end() |
| 58 | + ->end(); |
| 59 | + |
| 60 | + $this->registry->addTariffType($tariffTypeDefinition); |
| 61 | + |
| 62 | + $representations = $this->registryService->getRepresentationsByType(RepresentationInterface::class); |
| 63 | + |
| 64 | + $this->assertCount(2, $representations); |
| 65 | + } |
| 66 | + |
42 | 67 | public function testGetBehavior(): void |
43 | 68 | { |
44 | 69 | $tariffType = new DummyTariffType(); |
|
0 commit comments