/** * @depends testDeleteServiceRemovesExpectedConfigurationElements */ public function testDeletingNewerVersionOfServiceDoesNotRemoveRouteOrVersioningConfiguration() { $serviceName = 'HelloWorld'; $route = '/foo_conf/hello/world'; $httpMethods = array('GET', 'PATCH'); $selector = 'HalJson'; $result = $this->codeRpc->createService($serviceName, $route, $httpMethods, $selector); $this->assertInstanceOf('ZF\Apigility\Admin\Model\RpcServiceEntity', $result); $path = __DIR__ . '/TestAsset/module/FooConf'; $versioningModel = new VersioningModel($this->resource->factory('FooConf')); $this->assertTrue($versioningModel->createVersion('FooConf', 2)); $serviceName = str_replace('1', '2', $result->controllerServiceName); $service = $this->codeRpc->fetch($serviceName); $this->assertTrue($this->codeRpc->deleteService($service)); $config = include $path . '/config/module.config.php'; $this->assertInternalType('array', $config); $this->assertInternalType('array', $config['zf-versioning']); $this->assertInternalType('array', $config['router']['routes']); $this->assertArrayHasKey($result->controllerServiceName, $config['zf-rpc']); $this->assertArrayNotHasKey($serviceName, $config['zf-rpc']); $this->assertArrayHasKey($result->routeName, $config['router']['routes'], 'Route DELETED'); $this->assertContains($result->routeName, $config['zf-versioning']['uri'], 'Versioning DELETED'); }
/** * @depends testDeletingAServiceRemovesAllRelatedConfigKeys */ public function testDeletingNewerVersionOfServiceDoesNotRemoveRouteOrVersioningConfiguration() { $details = $this->getCreationPayload(); $service = $this->codeRest->createService($details); $path = __DIR__ . '/TestAsset/module/BarConf'; $versioningModel = new VersioningModel($this->resource->factory('BarConf')); $this->assertTrue($versioningModel->createVersion('BarConf', 2)); $serviceName = str_replace('1', '2', $service->controllerServiceName); $service = $this->codeRest->fetch($serviceName); $this->assertTrue($this->codeRest->deleteService($serviceName)); $config = (include $path . '/config/module.config.php'); $this->assertInternalType('array', $config); $this->assertInternalType('array', $config['zf-versioning']); $this->assertInternalType('array', $config['router']['routes']); $this->assertArrayHasKey('BarConf\\V1\\Rest\\Foo\\Controller', $config['zf-rest']); $this->assertArrayNotHasKey('BarConf\\V2\\Rest\\Foo\\Controller', $config['zf-rest']); $this->assertArrayHasKey('bar-conf.rest.foo', $config['router']['routes'], 'Route DELETED'); $this->assertContains('bar-conf.rest.foo', $config['zf-versioning']['uri'], 'Versioning DELETED'); }