eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/LegacyStorageEnginePassTest.php 1 location
|
@@ 176-197 (lines=22) @@
|
| 173 |
|
/** |
| 174 |
|
* @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LegacyStorageEnginePass::process |
| 175 |
|
*/ |
| 176 |
|
public function testRegisterConverterNoLazy() |
| 177 |
|
{ |
| 178 |
|
$fieldTypeIdentifier = 'fieldtype_identifier'; |
| 179 |
|
$serviceId = 'some_service_id'; |
| 180 |
|
$class = 'Some\Class'; |
| 181 |
|
|
| 182 |
|
$def = new Definition(); |
| 183 |
|
$def->setClass($class); |
| 184 |
|
$def->addTag( |
| 185 |
|
'ezpublish.storageEngine.legacy.converter', |
| 186 |
|
array('alias' => $fieldTypeIdentifier) |
| 187 |
|
); |
| 188 |
|
$this->setDefinition($serviceId, $def); |
| 189 |
|
|
| 190 |
|
$this->compile(); |
| 191 |
|
|
| 192 |
|
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
| 193 |
|
'ezpublish.api.storage_engine.legacy.factory', |
| 194 |
|
'registerFieldTypeConverter', |
| 195 |
|
array($fieldTypeIdentifier, new Reference($serviceId)) |
| 196 |
|
); |
| 197 |
|
} |
| 198 |
|
} |
| 199 |
|
|
eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/Compiler/RegisterStorageEnginePassTest.php 1 location
|
@@ 54-71 (lines=18) @@
|
| 51 |
|
); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
public function testRegisterDefaultStorageEngine() |
| 55 |
|
{ |
| 56 |
|
$storageEngineDef = new Definition(); |
| 57 |
|
$storageEngineIdentifier = 'i_am_a_storage_engine'; |
| 58 |
|
|
| 59 |
|
$this->container->setParameter('ezpublish.api.storage_engine.default', $storageEngineIdentifier); |
| 60 |
|
$storageEngineDef->addTag('ezpublish.storageEngine', array('alias' => $storageEngineIdentifier)); |
| 61 |
|
$serviceId = 'storage_engine_service'; |
| 62 |
|
$this->setDefinition($serviceId, $storageEngineDef); |
| 63 |
|
|
| 64 |
|
$this->compile(); |
| 65 |
|
|
| 66 |
|
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
| 67 |
|
'ezpublish.api.storage_engine.factory', |
| 68 |
|
'registerStorageEngine', |
| 69 |
|
array(new Reference($serviceId), $storageEngineIdentifier) |
| 70 |
|
); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
/** |
| 74 |
|
* @expectedException \LogicException |
eZ/Bundle/EzPublishDebugBundle/Tests/DependencyInjection/Compiler/DataCollectorPassTest.php 1 location
|
@@ 30-49 (lines=20) @@
|
| 27 |
|
$container->addCompilerPass(new DataCollectorPass()); |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public function testAddCollector() |
| 31 |
|
{ |
| 32 |
|
$panelTemplate = 'panel.html.twig'; |
| 33 |
|
$toolbarTemplate = 'toolbar.html.twig'; |
| 34 |
|
$definition = new Definition(); |
| 35 |
|
$definition->addTag( |
| 36 |
|
'ezpublish_data_collector', |
| 37 |
|
['panelTemplate' => $panelTemplate, 'toolbarTemplate' => $toolbarTemplate] |
| 38 |
|
); |
| 39 |
|
|
| 40 |
|
$serviceId = 'service_id'; |
| 41 |
|
$this->setDefinition($serviceId, $definition); |
| 42 |
|
$this->compile(); |
| 43 |
|
|
| 44 |
|
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
| 45 |
|
'ezpublish_debug.data_collector', |
| 46 |
|
'addCollector', |
| 47 |
|
array(new Reference($serviceId), $panelTemplate, $toolbarTemplate) |
| 48 |
|
); |
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
|
eZ/Publish/Core/Base/Tests/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php 1 location
|
@@ 105-123 (lines=19) @@
|
| 102 |
|
/** |
| 103 |
|
* @expectedException \LogicException |
| 104 |
|
*/ |
| 105 |
|
public function testRegisterExternalStorageHandlerWithoutRegisteredGateway() |
| 106 |
|
{ |
| 107 |
|
$handlerDef = new Definition(); |
| 108 |
|
$handlerDef->setClass( |
| 109 |
|
'eZ\Publish\Core\Base\Tests\Container\Compiler\Stubs\GatewayBasedStorageHandler' |
| 110 |
|
); |
| 111 |
|
$fieldTypeIdentifier = 'field_type_identifier'; |
| 112 |
|
$handlerDef->addTag('ezpublish.fieldType.externalStorageHandler', array('alias' => $fieldTypeIdentifier)); |
| 113 |
|
$storageHandlerServiceId = 'external_storage_handler_id'; |
| 114 |
|
$this->setDefinition($storageHandlerServiceId, $handlerDef); |
| 115 |
|
|
| 116 |
|
$this->compile(); |
| 117 |
|
|
| 118 |
|
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
| 119 |
|
'ezpublish.persistence.external_storage_registry.factory', |
| 120 |
|
'registerExternalStorageHandler', |
| 121 |
|
array($storageHandlerServiceId, $fieldTypeIdentifier) |
| 122 |
|
); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
/** |
| 126 |
|
* @expectedException \LogicException |
eZ/Publish/Core/Base/Tests/Container/Compiler/Storage/Legacy/FieldValueConverterRegistryPassTest.php 1 location
|
@@ 124-145 (lines=22) @@
|
| 121 |
|
); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
public function testRegisterConverterNoLazy() |
| 125 |
|
{ |
| 126 |
|
$fieldTypeIdentifier = 'fieldtype_identifier'; |
| 127 |
|
$serviceId = 'some_service_id'; |
| 128 |
|
$class = 'Some\Class'; |
| 129 |
|
|
| 130 |
|
$def = new Definition(); |
| 131 |
|
$def->setClass($class); |
| 132 |
|
$def->addTag( |
| 133 |
|
'ezpublish.storageEngine.legacy.converter', |
| 134 |
|
array('alias' => $fieldTypeIdentifier) |
| 135 |
|
); |
| 136 |
|
$this->setDefinition($serviceId, $def); |
| 137 |
|
|
| 138 |
|
$this->compile(); |
| 139 |
|
|
| 140 |
|
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
| 141 |
|
'ezpublish.persistence.legacy.field_value_converter.registry', |
| 142 |
|
'register', |
| 143 |
|
array($fieldTypeIdentifier, new Reference($serviceId)) |
| 144 |
|
); |
| 145 |
|
} |
| 146 |
|
} |
| 147 |
|
|