|
@@ 78-89 (lines=12) @@
|
| 75 |
|
/** |
| 76 |
|
* @covers BlockFactoryApiInterface::getInstance() |
| 77 |
|
*/ |
| 78 |
|
public function testGetInstanceOfAbstractExtensionBlock() |
| 79 |
|
{ |
| 80 |
|
$blockInstance = $this->api->getInstance(BarBlock::class, new AcmeFooModule()); |
| 81 |
|
$this->assertNotEmpty($blockInstance); |
| 82 |
|
$this->assertInstanceOf(AbstractBlockHandler::class, $blockInstance); |
| 83 |
|
$this->assertEquals('Bar', $blockInstance->getType()); |
| 84 |
|
$serviceNameHelper = new ServiceNameHelper(); |
| 85 |
|
$blockServiceName = $serviceNameHelper->generateServiceNameFromClassName(BarBlock::class); |
| 86 |
|
$this->assertTrue($this->container->has($blockServiceName)); |
| 87 |
|
$retrievedBlockService = $this->container->get($blockServiceName); |
| 88 |
|
$this->assertInstanceOf(BlockHandlerInterface::class, $retrievedBlockService); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
/** |
| 92 |
|
* @covers BlockFactoryApiInterface::getInstance() |
|
@@ 94-105 (lines=12) @@
|
| 91 |
|
/** |
| 92 |
|
* @covers BlockFactoryApiInterface::getInstance() |
| 93 |
|
*/ |
| 94 |
|
public function testGetInstanceOfInterfaceExtensionBlock() |
| 95 |
|
{ |
| 96 |
|
$blockInstance = $this->api->getInstance(FooBlock::class, new AcmeFooModule()); |
| 97 |
|
$this->assertNotEmpty($blockInstance); |
| 98 |
|
$this->assertInstanceOf(BlockHandlerInterface::class, $blockInstance); |
| 99 |
|
$this->assertEquals('FooType', $blockInstance->getType()); |
| 100 |
|
$serviceNameHelper = new ServiceNameHelper(); |
| 101 |
|
$blockServiceName = $serviceNameHelper->generateServiceNameFromClassName(FooBlock::class); |
| 102 |
|
$this->assertTrue($this->container->has($blockServiceName)); |
| 103 |
|
$retrievedBlockService = $this->container->get($blockServiceName); |
| 104 |
|
$this->assertInstanceOf(BlockHandlerInterface::class, $retrievedBlockService); |
| 105 |
|
} |
| 106 |
|
} |
| 107 |
|
|