| @@ 81-107 (lines=27) @@ | ||
| 78 | /** |
|
| 79 | * @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LegacyStorageEnginePass::process |
|
| 80 | */ |
|
| 81 | public function testRegisterConverter() |
|
| 82 | { |
|
| 83 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 84 | $serviceId = 'some_service_id'; |
|
| 85 | $class = 'Some\Class'; |
|
| 86 | $callback = '::foobar'; |
|
| 87 | ||
| 88 | $def = new Definition(); |
|
| 89 | $def->setClass($class); |
|
| 90 | $def->addTag( |
|
| 91 | 'ezpublish.storageEngine.legacy.converter', |
|
| 92 | array( |
|
| 93 | 'alias' => $fieldTypeIdentifier, |
|
| 94 | 'lazy' => true, |
|
| 95 | 'callback' => $callback, |
|
| 96 | ) |
|
| 97 | ); |
|
| 98 | $this->setDefinition($serviceId, $def); |
|
| 99 | ||
| 100 | $this->compile(); |
|
| 101 | ||
| 102 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 103 | 'ezpublish.api.storage_engine.legacy.factory', |
|
| 104 | 'registerFieldTypeConverter', |
|
| 105 | array($fieldTypeIdentifier, $class . $callback) |
|
| 106 | ); |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LegacyStorageEnginePass::process |
|
| @@ 114-139 (lines=26) @@ | ||
| 111 | * |
|
| 112 | * @expectedException \LogicException |
|
| 113 | */ |
|
| 114 | public function testRegisterConverterNoAlias() |
|
| 115 | { |
|
| 116 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 117 | $serviceId = 'some_service_id'; |
|
| 118 | $class = 'Some\Class'; |
|
| 119 | $callback = '::foobar'; |
|
| 120 | ||
| 121 | $def = new Definition(); |
|
| 122 | $def->setClass($class); |
|
| 123 | $def->addTag( |
|
| 124 | 'ezpublish.storageEngine.legacy.converter', |
|
| 125 | array( |
|
| 126 | 'lazy' => true, |
|
| 127 | 'callback' => $callback, |
|
| 128 | ) |
|
| 129 | ); |
|
| 130 | $this->setDefinition($serviceId, $def); |
|
| 131 | ||
| 132 | $this->compile(); |
|
| 133 | ||
| 134 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 135 | 'ezpublish.api.storage_engine.legacy.factory', |
|
| 136 | 'registerFieldTypeConverter', |
|
| 137 | array($fieldTypeIdentifier, $class . $callback) |
|
| 138 | ); |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LegacyStorageEnginePass::process |
|
| @@ 146-171 (lines=26) @@ | ||
| 143 | * |
|
| 144 | * @expectedException \LogicException |
|
| 145 | */ |
|
| 146 | public function testRegisterConverterLazyNoCallback() |
|
| 147 | { |
|
| 148 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 149 | $serviceId = 'some_service_id'; |
|
| 150 | $class = 'Some\Class'; |
|
| 151 | $callback = '::foobar'; |
|
| 152 | ||
| 153 | $def = new Definition(); |
|
| 154 | $def->setClass($class); |
|
| 155 | $def->addTag( |
|
| 156 | 'ezpublish.storageEngine.legacy.converter', |
|
| 157 | array( |
|
| 158 | 'alias' => $fieldTypeIdentifier, |
|
| 159 | 'lazy' => true, |
|
| 160 | ) |
|
| 161 | ); |
|
| 162 | $this->setDefinition($serviceId, $def); |
|
| 163 | ||
| 164 | $this->compile(); |
|
| 165 | ||
| 166 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 167 | 'ezpublish.api.storage_engine.legacy.factory', |
|
| 168 | 'registerFieldTypeConverter', |
|
| 169 | array($fieldTypeIdentifier, $class . $callback) |
|
| 170 | ); |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LegacyStorageEnginePass::process |
|
| @@ 36-62 (lines=27) @@ | ||
| 33 | $container->addCompilerPass(new FieldValueConverterRegistryPass()); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testRegisterConverter() |
|
| 37 | { |
|
| 38 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 39 | $serviceId = 'some_service_id'; |
|
| 40 | $class = 'Some\Class'; |
|
| 41 | $callback = '::foobar'; |
|
| 42 | ||
| 43 | $def = new Definition(); |
|
| 44 | $def->setClass($class); |
|
| 45 | $def->addTag( |
|
| 46 | 'ezpublish.storageEngine.legacy.converter', |
|
| 47 | array( |
|
| 48 | 'alias' => $fieldTypeIdentifier, |
|
| 49 | 'lazy' => true, |
|
| 50 | 'callback' => $callback, |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | $this->setDefinition($serviceId, $def); |
|
| 54 | ||
| 55 | $this->compile(); |
|
| 56 | ||
| 57 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 58 | 'ezpublish.persistence.legacy.field_value_converter.registry', |
|
| 59 | 'register', |
|
| 60 | array($fieldTypeIdentifier, $class . $callback) |
|
| 61 | ); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @expectedException \LogicException |
|
| @@ 67-92 (lines=26) @@ | ||
| 64 | /** |
|
| 65 | * @expectedException \LogicException |
|
| 66 | */ |
|
| 67 | public function testRegisterConverterNoAlias() |
|
| 68 | { |
|
| 69 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 70 | $serviceId = 'some_service_id'; |
|
| 71 | $class = 'Some\Class'; |
|
| 72 | $callback = '::foobar'; |
|
| 73 | ||
| 74 | $def = new Definition(); |
|
| 75 | $def->setClass($class); |
|
| 76 | $def->addTag( |
|
| 77 | 'ezpublish.storageEngine.legacy.converter', |
|
| 78 | array( |
|
| 79 | 'lazy' => true, |
|
| 80 | 'callback' => $callback, |
|
| 81 | ) |
|
| 82 | ); |
|
| 83 | $this->setDefinition($serviceId, $def); |
|
| 84 | ||
| 85 | $this->compile(); |
|
| 86 | ||
| 87 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 88 | 'ezpublish.persistence.legacy.field_value_converter.registry', |
|
| 89 | 'register', |
|
| 90 | array($fieldTypeIdentifier, $class . $callback) |
|
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * @expectedException \LogicException |
|
| @@ 97-122 (lines=26) @@ | ||
| 94 | /** |
|
| 95 | * @expectedException \LogicException |
|
| 96 | */ |
|
| 97 | public function testRegisterConverterLazyNoCallback() |
|
| 98 | { |
|
| 99 | $fieldTypeIdentifier = 'fieldtype_identifier'; |
|
| 100 | $serviceId = 'some_service_id'; |
|
| 101 | $class = 'Some\Class'; |
|
| 102 | $callback = '::foobar'; |
|
| 103 | ||
| 104 | $def = new Definition(); |
|
| 105 | $def->setClass($class); |
|
| 106 | $def->addTag( |
|
| 107 | 'ezpublish.storageEngine.legacy.converter', |
|
| 108 | array( |
|
| 109 | 'alias' => $fieldTypeIdentifier, |
|
| 110 | 'lazy' => true, |
|
| 111 | ) |
|
| 112 | ); |
|
| 113 | $this->setDefinition($serviceId, $def); |
|
| 114 | ||
| 115 | $this->compile(); |
|
| 116 | ||
| 117 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 118 | 'ezpublish.persistence.legacy.field_value_converter.registry', |
|
| 119 | 'register', |
|
| 120 | array($fieldTypeIdentifier, $class . $callback) |
|
| 121 | ); |
|
| 122 | } |
|
| 123 | ||
| 124 | public function testRegisterConverterNoLazy() |
|
| 125 | { |
|