@@ -12,10 +12,10 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class DistributionReportControllerFactory implements FactoryInterface |
| 14 | 14 | { |
| 15 | - public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 16 | - { |
|
| 17 | - return new DistributionReportController( |
|
| 18 | - $container->get(AdapterInterface::class) |
|
| 19 | - ); |
|
| 20 | - } |
|
| 15 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 16 | + { |
|
| 17 | + return new DistributionReportController( |
|
| 18 | + $container->get(AdapterInterface::class) |
|
| 19 | + ); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -12,113 +12,113 @@ |
||
| 12 | 12 | use Zend\ServiceManager\Factory\InvokableFactory; |
| 13 | 13 | |
| 14 | 14 | return [ |
| 15 | - 'router' => [ |
|
| 16 | - 'routes' => [ |
|
| 17 | - // Distribution Report Routes |
|
| 18 | - 'informe-todos-sectores' => [ |
|
| 19 | - 'type' => Segment::class, |
|
| 20 | - 'options' => [ |
|
| 21 | - 'route' => '/informe/distribucion-sectores[/:ano]', |
|
| 22 | - 'defaults' => [ |
|
| 23 | - 'controller' => Controller\DistributionReportController::class, |
|
| 24 | - 'action' => 'getWholeSectoralDistribution', |
|
| 25 | - ], |
|
| 26 | - ], |
|
| 27 | - ], |
|
| 28 | - 'informe-por-sector' => [ |
|
| 29 | - 'type' => Segment::class, |
|
| 30 | - 'options' => [ |
|
| 31 | - 'route' => '/informe/distribucion-sector[/:ano[/:sector_id]]', |
|
| 32 | - 'defaults' => [ |
|
| 33 | - 'controller' => Controller\DistributionReportController::class, |
|
| 34 | - 'action' => 'getSectoralDistribution', |
|
| 35 | - ], |
|
| 36 | - ], |
|
| 37 | - ], |
|
| 38 | - 'informe-gas' => [ |
|
| 39 | - 'type' => Segment::class, |
|
| 40 | - 'options' => [ |
|
| 41 | - 'route' => '/informe/distribucion-gases[/:ano]', |
|
| 42 | - 'defaults' => [ |
|
| 43 | - 'controller' => Controller\DistributionReportController::class, |
|
| 44 | - 'action' => 'getGasesDistribution', |
|
| 45 | - ], |
|
| 46 | - ], |
|
| 47 | - ], |
|
| 48 | - 'informe-gas-por-sector' => [ |
|
| 49 | - 'type' => Segment::class, |
|
| 50 | - 'options' => [ |
|
| 51 | - 'route' => '/informe/distribucion-gases-sector[/:ano]', |
|
| 52 | - 'defaults' => [ |
|
| 53 | - 'controller' => Controller\DistributionReportController::class, |
|
| 54 | - 'action' => 'getSectoralGasesDistribution', |
|
| 55 | - ], |
|
| 56 | - ], |
|
| 57 | - ], |
|
| 58 | - // Evolution Report Routes |
|
| 59 | - 'informe-evolucion-sectores' => [ |
|
| 60 | - 'type' => Segment::class, |
|
| 61 | - 'options' => [ |
|
| 62 | - 'route' => '/informe/evolucion-sectores', |
|
| 63 | - 'defaults' => [ |
|
| 64 | - 'controller' => Controller\EvolutionReportController::class, |
|
| 65 | - 'action' => 'getWholeSectoralEvolution', |
|
| 66 | - ], |
|
| 67 | - ], |
|
| 68 | - ], |
|
| 69 | - 'informe-evolucion-sector' => [ |
|
| 70 | - 'type' => Segment::class, |
|
| 71 | - 'options' => [ |
|
| 72 | - 'route' => '/informe/evolucion-sector[/:sector_id]', |
|
| 73 | - 'defaults' => [ |
|
| 74 | - 'controller' => Controller\EvolutionReportController::class, |
|
| 75 | - 'action' => 'getSectoralEvolution', |
|
| 76 | - ], |
|
| 77 | - ], |
|
| 78 | - ], |
|
| 79 | - 'informe-evolucion-sector-subactividad' => [ |
|
| 80 | - 'type' => Segment::class, |
|
| 81 | - 'options' => [ |
|
| 82 | - 'route' => '/informe/evolucion-sector-subactividad[/:sector_id]', |
|
| 83 | - 'defaults' => [ |
|
| 84 | - 'controller' => Controller\EvolutionReportController::class, |
|
| 85 | - 'action' => 'getSectoralEvolutionSubactivity', |
|
| 86 | - ], |
|
| 87 | - ], |
|
| 88 | - ], |
|
| 89 | - 'informe-evolucion-sector-subactividad-categoria' => [ |
|
| 90 | - 'type' => Segment::class, |
|
| 91 | - 'options' => [ |
|
| 92 | - 'route' => '/informe/evolucion-sector-subactividad-categoria[/:sector_id[/:subactividad_id]]', |
|
| 93 | - 'defaults' => [ |
|
| 94 | - 'controller' => Controller\EvolutionReportController::class, |
|
| 95 | - 'action' => 'getSectoralEvolutionSubactivityCategory', |
|
| 96 | - ], |
|
| 97 | - ], |
|
| 98 | - ], |
|
| 99 | - // Indicators Report Routes |
|
| 100 | - 'informe-indicador' => [ |
|
| 101 | - 'type' => Segment::class, |
|
| 102 | - 'options' => [ |
|
| 103 | - 'route' => '/informe/indicador[/:indicador_id]', |
|
| 104 | - 'defaults' => [ |
|
| 105 | - 'controller' => Controller\IndicatorsReportController::class, |
|
| 106 | - 'action' => 'getIndicator', |
|
| 107 | - ], |
|
| 108 | - ], |
|
| 109 | - ], |
|
| 110 | - ], |
|
| 111 | - ], |
|
| 112 | - 'controllers' => [ |
|
| 113 | - 'factories' => [ |
|
| 114 | - Controller\DistributionReportController::class => Factory\DistributionReportControllerFactory::class, |
|
| 115 | - Controller\EvolutionReportController::class => Factory\EvolutionReportControllerFactory::class, |
|
| 116 | - Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 117 | - ], |
|
| 118 | - ], |
|
| 119 | - 'view_manager' => [ |
|
| 120 | - 'strategies' => [ |
|
| 121 | - 'ViewJsonStrategy' |
|
| 122 | - ], |
|
| 123 | - ], |
|
| 15 | + 'router' => [ |
|
| 16 | + 'routes' => [ |
|
| 17 | + // Distribution Report Routes |
|
| 18 | + 'informe-todos-sectores' => [ |
|
| 19 | + 'type' => Segment::class, |
|
| 20 | + 'options' => [ |
|
| 21 | + 'route' => '/informe/distribucion-sectores[/:ano]', |
|
| 22 | + 'defaults' => [ |
|
| 23 | + 'controller' => Controller\DistributionReportController::class, |
|
| 24 | + 'action' => 'getWholeSectoralDistribution', |
|
| 25 | + ], |
|
| 26 | + ], |
|
| 27 | + ], |
|
| 28 | + 'informe-por-sector' => [ |
|
| 29 | + 'type' => Segment::class, |
|
| 30 | + 'options' => [ |
|
| 31 | + 'route' => '/informe/distribucion-sector[/:ano[/:sector_id]]', |
|
| 32 | + 'defaults' => [ |
|
| 33 | + 'controller' => Controller\DistributionReportController::class, |
|
| 34 | + 'action' => 'getSectoralDistribution', |
|
| 35 | + ], |
|
| 36 | + ], |
|
| 37 | + ], |
|
| 38 | + 'informe-gas' => [ |
|
| 39 | + 'type' => Segment::class, |
|
| 40 | + 'options' => [ |
|
| 41 | + 'route' => '/informe/distribucion-gases[/:ano]', |
|
| 42 | + 'defaults' => [ |
|
| 43 | + 'controller' => Controller\DistributionReportController::class, |
|
| 44 | + 'action' => 'getGasesDistribution', |
|
| 45 | + ], |
|
| 46 | + ], |
|
| 47 | + ], |
|
| 48 | + 'informe-gas-por-sector' => [ |
|
| 49 | + 'type' => Segment::class, |
|
| 50 | + 'options' => [ |
|
| 51 | + 'route' => '/informe/distribucion-gases-sector[/:ano]', |
|
| 52 | + 'defaults' => [ |
|
| 53 | + 'controller' => Controller\DistributionReportController::class, |
|
| 54 | + 'action' => 'getSectoralGasesDistribution', |
|
| 55 | + ], |
|
| 56 | + ], |
|
| 57 | + ], |
|
| 58 | + // Evolution Report Routes |
|
| 59 | + 'informe-evolucion-sectores' => [ |
|
| 60 | + 'type' => Segment::class, |
|
| 61 | + 'options' => [ |
|
| 62 | + 'route' => '/informe/evolucion-sectores', |
|
| 63 | + 'defaults' => [ |
|
| 64 | + 'controller' => Controller\EvolutionReportController::class, |
|
| 65 | + 'action' => 'getWholeSectoralEvolution', |
|
| 66 | + ], |
|
| 67 | + ], |
|
| 68 | + ], |
|
| 69 | + 'informe-evolucion-sector' => [ |
|
| 70 | + 'type' => Segment::class, |
|
| 71 | + 'options' => [ |
|
| 72 | + 'route' => '/informe/evolucion-sector[/:sector_id]', |
|
| 73 | + 'defaults' => [ |
|
| 74 | + 'controller' => Controller\EvolutionReportController::class, |
|
| 75 | + 'action' => 'getSectoralEvolution', |
|
| 76 | + ], |
|
| 77 | + ], |
|
| 78 | + ], |
|
| 79 | + 'informe-evolucion-sector-subactividad' => [ |
|
| 80 | + 'type' => Segment::class, |
|
| 81 | + 'options' => [ |
|
| 82 | + 'route' => '/informe/evolucion-sector-subactividad[/:sector_id]', |
|
| 83 | + 'defaults' => [ |
|
| 84 | + 'controller' => Controller\EvolutionReportController::class, |
|
| 85 | + 'action' => 'getSectoralEvolutionSubactivity', |
|
| 86 | + ], |
|
| 87 | + ], |
|
| 88 | + ], |
|
| 89 | + 'informe-evolucion-sector-subactividad-categoria' => [ |
|
| 90 | + 'type' => Segment::class, |
|
| 91 | + 'options' => [ |
|
| 92 | + 'route' => '/informe/evolucion-sector-subactividad-categoria[/:sector_id[/:subactividad_id]]', |
|
| 93 | + 'defaults' => [ |
|
| 94 | + 'controller' => Controller\EvolutionReportController::class, |
|
| 95 | + 'action' => 'getSectoralEvolutionSubactivityCategory', |
|
| 96 | + ], |
|
| 97 | + ], |
|
| 98 | + ], |
|
| 99 | + // Indicators Report Routes |
|
| 100 | + 'informe-indicador' => [ |
|
| 101 | + 'type' => Segment::class, |
|
| 102 | + 'options' => [ |
|
| 103 | + 'route' => '/informe/indicador[/:indicador_id]', |
|
| 104 | + 'defaults' => [ |
|
| 105 | + 'controller' => Controller\IndicatorsReportController::class, |
|
| 106 | + 'action' => 'getIndicator', |
|
| 107 | + ], |
|
| 108 | + ], |
|
| 109 | + ], |
|
| 110 | + ], |
|
| 111 | + ], |
|
| 112 | + 'controllers' => [ |
|
| 113 | + 'factories' => [ |
|
| 114 | + Controller\DistributionReportController::class => Factory\DistributionReportControllerFactory::class, |
|
| 115 | + Controller\EvolutionReportController::class => Factory\EvolutionReportControllerFactory::class, |
|
| 116 | + Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 117 | + ], |
|
| 118 | + ], |
|
| 119 | + 'view_manager' => [ |
|
| 120 | + 'strategies' => [ |
|
| 121 | + 'ViewJsonStrategy' |
|
| 122 | + ], |
|
| 123 | + ], |
|
| 124 | 124 | ]; |
@@ -16,81 +16,81 @@ |
||
| 16 | 16 | |
| 17 | 17 | class IndicatorsReportControllerTest extends AbstractHttpControllerTestCase |
| 18 | 18 | { |
| 19 | - use TestCaseTrait; |
|
| 20 | - |
|
| 21 | - private static $pdo = null; |
|
| 22 | - |
|
| 23 | - private $conn = null; |
|
| 24 | - |
|
| 25 | - public function setUp() |
|
| 26 | - { |
|
| 27 | - $configOverrides = []; |
|
| 28 | - |
|
| 29 | - $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | - $configOverrides |
|
| 32 | - )); |
|
| 33 | - |
|
| 34 | - $services = $this->getApplicationServiceLocator(); |
|
| 35 | - $config = $services->get('config'); |
|
| 36 | - unset($config['db']); |
|
| 37 | - $services->setAllowOverride(true); |
|
| 38 | - $services->setService('config', $config); |
|
| 39 | - $services->setAllowOverride(false); |
|
| 40 | - |
|
| 41 | - parent::setUp(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - final public function getConnection() |
|
| 45 | - { |
|
| 46 | - if ($this->conn === null) { |
|
| 47 | - if (self::$pdo == null) { |
|
| 48 | - self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | - } |
|
| 50 | - $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $this->conn; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - protected function getDataSet() |
|
| 57 | - { |
|
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function testGetIndicatorActionCanBeAccessed() |
|
| 62 | - { |
|
| 63 | - $this->dispatch('/informe/indicador/2', 'GET'); |
|
| 64 | - $this->assertResponseStatusCode(200); |
|
| 65 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | - $this->assertModuleName('api'); |
|
| 67 | - $this->assertControllerName(IndicatorsReportController::class); |
|
| 68 | - $this->assertControllerClass('IndicatorsReportController'); |
|
| 69 | - $this->assertMatchedRouteName('informe-indicador'); |
|
| 70 | - |
|
| 71 | - $data = $this->getResponse()->getContent(); |
|
| 72 | - |
|
| 73 | - $this->assertJson($data); |
|
| 74 | - |
|
| 75 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | - |
|
| 77 | - $this->assertArrayHasKey('column_1', $data); |
|
| 78 | - $this->assertArrayHasKey('colores', $data); |
|
| 79 | - $this->assertArrayHasKey('column_2', $data); |
|
| 80 | - $this->assertArrayHasKey('descripcion', $data); |
|
| 81 | - $this->assertArrayHasKey('unidad', $data); |
|
| 82 | - $this->assertArrayHasKey('indicador', $data); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - public function testInvalidRouteDoesNotCrash() |
|
| 86 | - { |
|
| 87 | - $this->dispatch('/invalid/route', 'GET'); |
|
| 88 | - $this->assertResponseStatusCode(404); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - // public function testInvalidHttpVerbDoesNotCrash() |
|
| 92 | - // { |
|
| 93 | - // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 94 | - // $this->assertResponseStatusCode(405); |
|
| 95 | - // } |
|
| 19 | + use TestCaseTrait; |
|
| 20 | + |
|
| 21 | + private static $pdo = null; |
|
| 22 | + |
|
| 23 | + private $conn = null; |
|
| 24 | + |
|
| 25 | + public function setUp() |
|
| 26 | + { |
|
| 27 | + $configOverrides = []; |
|
| 28 | + |
|
| 29 | + $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | + include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | + $configOverrides |
|
| 32 | + )); |
|
| 33 | + |
|
| 34 | + $services = $this->getApplicationServiceLocator(); |
|
| 35 | + $config = $services->get('config'); |
|
| 36 | + unset($config['db']); |
|
| 37 | + $services->setAllowOverride(true); |
|
| 38 | + $services->setService('config', $config); |
|
| 39 | + $services->setAllowOverride(false); |
|
| 40 | + |
|
| 41 | + parent::setUp(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + final public function getConnection() |
|
| 45 | + { |
|
| 46 | + if ($this->conn === null) { |
|
| 47 | + if (self::$pdo == null) { |
|
| 48 | + self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | + } |
|
| 50 | + $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $this->conn; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + protected function getDataSet() |
|
| 57 | + { |
|
| 58 | + return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + public function testGetIndicatorActionCanBeAccessed() |
|
| 62 | + { |
|
| 63 | + $this->dispatch('/informe/indicador/2', 'GET'); |
|
| 64 | + $this->assertResponseStatusCode(200); |
|
| 65 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | + $this->assertModuleName('api'); |
|
| 67 | + $this->assertControllerName(IndicatorsReportController::class); |
|
| 68 | + $this->assertControllerClass('IndicatorsReportController'); |
|
| 69 | + $this->assertMatchedRouteName('informe-indicador'); |
|
| 70 | + |
|
| 71 | + $data = $this->getResponse()->getContent(); |
|
| 72 | + |
|
| 73 | + $this->assertJson($data); |
|
| 74 | + |
|
| 75 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | + |
|
| 77 | + $this->assertArrayHasKey('column_1', $data); |
|
| 78 | + $this->assertArrayHasKey('colores', $data); |
|
| 79 | + $this->assertArrayHasKey('column_2', $data); |
|
| 80 | + $this->assertArrayHasKey('descripcion', $data); |
|
| 81 | + $this->assertArrayHasKey('unidad', $data); |
|
| 82 | + $this->assertArrayHasKey('indicador', $data); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + public function testInvalidRouteDoesNotCrash() |
|
| 86 | + { |
|
| 87 | + $this->dispatch('/invalid/route', 'GET'); |
|
| 88 | + $this->assertResponseStatusCode(404); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + // public function testInvalidHttpVerbDoesNotCrash() |
|
| 92 | + // { |
|
| 93 | + // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 94 | + // $this->assertResponseStatusCode(405); |
|
| 95 | + // } |
|
| 96 | 96 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $configOverrides = []; |
| 28 | 28 | |
| 29 | 29 | $this->setApplicationConfig(ArrayUtils::merge( |
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 30 | + include __DIR__.'/../../../../config/application.config.php', |
|
| 31 | 31 | $configOverrides |
| 32 | 32 | )); |
| 33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function getDataSet() |
| 57 | 57 | { |
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 58 | + return $this->createXMLDataSet(__DIR__.'/../fixtures/database.xml'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function testGetIndicatorActionCanBeAccessed() |
@@ -16,137 +16,137 @@ |
||
| 16 | 16 | |
| 17 | 17 | class DistributionReportControllerTest extends AbstractHttpControllerTestCase |
| 18 | 18 | { |
| 19 | - use TestCaseTrait; |
|
| 20 | - |
|
| 21 | - private static $pdo = null; |
|
| 22 | - |
|
| 23 | - private $conn = null; |
|
| 24 | - |
|
| 25 | - public function setUp() |
|
| 26 | - { |
|
| 27 | - $configOverrides = []; |
|
| 28 | - |
|
| 29 | - $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | - $configOverrides |
|
| 32 | - )); |
|
| 33 | - |
|
| 34 | - $services = $this->getApplicationServiceLocator(); |
|
| 35 | - $config = $services->get('config'); |
|
| 36 | - unset($config['db']); |
|
| 37 | - $services->setAllowOverride(true); |
|
| 38 | - $services->setService('config', $config); |
|
| 39 | - $services->setAllowOverride(false); |
|
| 40 | - |
|
| 41 | - parent::setUp(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - final public function getConnection() |
|
| 45 | - { |
|
| 46 | - if ($this->conn === null) { |
|
| 47 | - if (self::$pdo == null) { |
|
| 48 | - self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | - } |
|
| 50 | - $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $this->conn; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - protected function getDataSet() |
|
| 57 | - { |
|
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function testGetWholeSectoralDistributionActionActionCanBeAccessed() |
|
| 62 | - { |
|
| 63 | - $this->dispatch('/informe/distribucion-sectores/2014', 'GET'); |
|
| 64 | - $this->assertResponseStatusCode(200); |
|
| 65 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | - $this->assertModuleName('api'); |
|
| 67 | - $this->assertControllerName(DistributionReportController::class); |
|
| 68 | - $this->assertControllerClass('DistributionReportController'); |
|
| 69 | - $this->assertMatchedRouteName('informe-todos-sectores'); |
|
| 70 | - |
|
| 71 | - $data = $this->getResponse()->getContent(); |
|
| 72 | - |
|
| 73 | - $this->assertJson($data); |
|
| 74 | - |
|
| 75 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | - |
|
| 77 | - $this->assertArrayHasKey('sector_1', $data); |
|
| 78 | - $this->assertArrayHasKey('colores', $data); |
|
| 79 | - $this->assertArrayHasKey('descripciones', $data); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - public function testGetSectoralDistributionActionCanBeAccessed() |
|
| 83 | - { |
|
| 84 | - $this->dispatch('/informe/distribucion-sector/2014/1', 'GET'); |
|
| 85 | - $this->assertResponseStatusCode(200); |
|
| 86 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 87 | - $this->assertModuleName('api'); |
|
| 88 | - $this->assertControllerName(DistributionReportController::class); |
|
| 89 | - $this->assertControllerClass('DistributionReportController'); |
|
| 90 | - $this->assertMatchedRouteName('informe-por-sector'); |
|
| 91 | - |
|
| 92 | - $data = $this->getResponse()->getContent(); |
|
| 93 | - |
|
| 94 | - $this->assertJson($data); |
|
| 95 | - |
|
| 96 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 97 | - |
|
| 98 | - $this->assertArrayHasKey('graph_data', $data); |
|
| 99 | - $this->assertArrayHasKey('sector', $data); |
|
| 100 | - $this->assertArrayHasKey('totalActividades', $data); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - public function testGetGasesDistributionActionCanBeAccessed() |
|
| 104 | - { |
|
| 105 | - $this->dispatch('/informe/distribucion-gases/2014', 'GET'); |
|
| 106 | - $this->assertResponseStatusCode(200); |
|
| 107 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 108 | - $this->assertModuleName('api'); |
|
| 109 | - $this->assertControllerName(DistributionReportController::class); |
|
| 110 | - $this->assertControllerClass('DistributionReportController'); |
|
| 111 | - $this->assertMatchedRouteName('informe-gas'); |
|
| 112 | - |
|
| 113 | - $data = $this->getResponse()->getContent(); |
|
| 114 | - |
|
| 115 | - $this->assertJson($data); |
|
| 116 | - |
|
| 117 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 118 | - |
|
| 119 | - $this->assertArrayHasKey('colores', $data); |
|
| 120 | - $this->assertArrayHasKey('gases', $data); |
|
| 121 | - $this->assertArrayHasKey('valores', $data); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - public function testGetSectoralGasesDistributionActionCanBeAccessed() |
|
| 125 | - { |
|
| 126 | - $this->dispatch('/informe/distribucion-gases-sector/2014', 'GET'); |
|
| 127 | - $this->assertResponseStatusCode(200); |
|
| 128 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 129 | - $this->assertModuleName('api'); |
|
| 130 | - $this->assertControllerName(DistributionReportController::class); |
|
| 131 | - $this->assertControllerClass('DistributionReportController'); |
|
| 132 | - $this->assertMatchedRouteName('informe-gas-por-sector'); |
|
| 133 | - |
|
| 134 | - $data = $this->getResponse()->getContent(); |
|
| 135 | - |
|
| 136 | - $this->assertJson($data); |
|
| 137 | - |
|
| 138 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function testInvalidRouteDoesNotCrash() |
|
| 142 | - { |
|
| 143 | - $this->dispatch('/invalid/route', 'GET'); |
|
| 144 | - $this->assertResponseStatusCode(404); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // public function testInvalidHttpVerbDoesNotCrash() |
|
| 148 | - // { |
|
| 149 | - // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 150 | - // $this->assertResponseStatusCode(405); |
|
| 151 | - // } |
|
| 19 | + use TestCaseTrait; |
|
| 20 | + |
|
| 21 | + private static $pdo = null; |
|
| 22 | + |
|
| 23 | + private $conn = null; |
|
| 24 | + |
|
| 25 | + public function setUp() |
|
| 26 | + { |
|
| 27 | + $configOverrides = []; |
|
| 28 | + |
|
| 29 | + $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | + include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | + $configOverrides |
|
| 32 | + )); |
|
| 33 | + |
|
| 34 | + $services = $this->getApplicationServiceLocator(); |
|
| 35 | + $config = $services->get('config'); |
|
| 36 | + unset($config['db']); |
|
| 37 | + $services->setAllowOverride(true); |
|
| 38 | + $services->setService('config', $config); |
|
| 39 | + $services->setAllowOverride(false); |
|
| 40 | + |
|
| 41 | + parent::setUp(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + final public function getConnection() |
|
| 45 | + { |
|
| 46 | + if ($this->conn === null) { |
|
| 47 | + if (self::$pdo == null) { |
|
| 48 | + self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | + } |
|
| 50 | + $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $this->conn; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + protected function getDataSet() |
|
| 57 | + { |
|
| 58 | + return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + public function testGetWholeSectoralDistributionActionActionCanBeAccessed() |
|
| 62 | + { |
|
| 63 | + $this->dispatch('/informe/distribucion-sectores/2014', 'GET'); |
|
| 64 | + $this->assertResponseStatusCode(200); |
|
| 65 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | + $this->assertModuleName('api'); |
|
| 67 | + $this->assertControllerName(DistributionReportController::class); |
|
| 68 | + $this->assertControllerClass('DistributionReportController'); |
|
| 69 | + $this->assertMatchedRouteName('informe-todos-sectores'); |
|
| 70 | + |
|
| 71 | + $data = $this->getResponse()->getContent(); |
|
| 72 | + |
|
| 73 | + $this->assertJson($data); |
|
| 74 | + |
|
| 75 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | + |
|
| 77 | + $this->assertArrayHasKey('sector_1', $data); |
|
| 78 | + $this->assertArrayHasKey('colores', $data); |
|
| 79 | + $this->assertArrayHasKey('descripciones', $data); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + public function testGetSectoralDistributionActionCanBeAccessed() |
|
| 83 | + { |
|
| 84 | + $this->dispatch('/informe/distribucion-sector/2014/1', 'GET'); |
|
| 85 | + $this->assertResponseStatusCode(200); |
|
| 86 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 87 | + $this->assertModuleName('api'); |
|
| 88 | + $this->assertControllerName(DistributionReportController::class); |
|
| 89 | + $this->assertControllerClass('DistributionReportController'); |
|
| 90 | + $this->assertMatchedRouteName('informe-por-sector'); |
|
| 91 | + |
|
| 92 | + $data = $this->getResponse()->getContent(); |
|
| 93 | + |
|
| 94 | + $this->assertJson($data); |
|
| 95 | + |
|
| 96 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 97 | + |
|
| 98 | + $this->assertArrayHasKey('graph_data', $data); |
|
| 99 | + $this->assertArrayHasKey('sector', $data); |
|
| 100 | + $this->assertArrayHasKey('totalActividades', $data); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + public function testGetGasesDistributionActionCanBeAccessed() |
|
| 104 | + { |
|
| 105 | + $this->dispatch('/informe/distribucion-gases/2014', 'GET'); |
|
| 106 | + $this->assertResponseStatusCode(200); |
|
| 107 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 108 | + $this->assertModuleName('api'); |
|
| 109 | + $this->assertControllerName(DistributionReportController::class); |
|
| 110 | + $this->assertControllerClass('DistributionReportController'); |
|
| 111 | + $this->assertMatchedRouteName('informe-gas'); |
|
| 112 | + |
|
| 113 | + $data = $this->getResponse()->getContent(); |
|
| 114 | + |
|
| 115 | + $this->assertJson($data); |
|
| 116 | + |
|
| 117 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 118 | + |
|
| 119 | + $this->assertArrayHasKey('colores', $data); |
|
| 120 | + $this->assertArrayHasKey('gases', $data); |
|
| 121 | + $this->assertArrayHasKey('valores', $data); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + public function testGetSectoralGasesDistributionActionCanBeAccessed() |
|
| 125 | + { |
|
| 126 | + $this->dispatch('/informe/distribucion-gases-sector/2014', 'GET'); |
|
| 127 | + $this->assertResponseStatusCode(200); |
|
| 128 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 129 | + $this->assertModuleName('api'); |
|
| 130 | + $this->assertControllerName(DistributionReportController::class); |
|
| 131 | + $this->assertControllerClass('DistributionReportController'); |
|
| 132 | + $this->assertMatchedRouteName('informe-gas-por-sector'); |
|
| 133 | + |
|
| 134 | + $data = $this->getResponse()->getContent(); |
|
| 135 | + |
|
| 136 | + $this->assertJson($data); |
|
| 137 | + |
|
| 138 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function testInvalidRouteDoesNotCrash() |
|
| 142 | + { |
|
| 143 | + $this->dispatch('/invalid/route', 'GET'); |
|
| 144 | + $this->assertResponseStatusCode(404); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // public function testInvalidHttpVerbDoesNotCrash() |
|
| 148 | + // { |
|
| 149 | + // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 150 | + // $this->assertResponseStatusCode(405); |
|
| 151 | + // } |
|
| 152 | 152 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $configOverrides = []; |
| 28 | 28 | |
| 29 | 29 | $this->setApplicationConfig(ArrayUtils::merge( |
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 30 | + include __DIR__.'/../../../../config/application.config.php', |
|
| 31 | 31 | $configOverrides |
| 32 | 32 | )); |
| 33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function getDataSet() |
| 57 | 57 | { |
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 58 | + return $this->createXMLDataSet(__DIR__.'/../fixtures/database.xml'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function testGetWholeSectoralDistributionActionActionCanBeAccessed() |
@@ -16,137 +16,137 @@ |
||
| 16 | 16 | |
| 17 | 17 | class EvolutionReportControllerTest extends AbstractHttpControllerTestCase |
| 18 | 18 | { |
| 19 | - use TestCaseTrait; |
|
| 20 | - |
|
| 21 | - private static $pdo = null; |
|
| 22 | - |
|
| 23 | - private $conn = null; |
|
| 24 | - |
|
| 25 | - public function setUp() |
|
| 26 | - { |
|
| 27 | - $configOverrides = []; |
|
| 28 | - |
|
| 29 | - $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | - $configOverrides |
|
| 32 | - )); |
|
| 33 | - |
|
| 34 | - $services = $this->getApplicationServiceLocator(); |
|
| 35 | - $config = $services->get('config'); |
|
| 36 | - unset($config['db']); |
|
| 37 | - $services->setAllowOverride(true); |
|
| 38 | - $services->setService('config', $config); |
|
| 39 | - $services->setAllowOverride(false); |
|
| 40 | - |
|
| 41 | - parent::setUp(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - final public function getConnection() |
|
| 45 | - { |
|
| 46 | - if ($this->conn === null) { |
|
| 47 | - if (self::$pdo == null) { |
|
| 48 | - self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | - } |
|
| 50 | - $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $this->conn; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - protected function getDataSet() |
|
| 57 | - { |
|
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function testGetWholeSectoralEvolutionActionCanBeAccessed() |
|
| 62 | - { |
|
| 63 | - $this->dispatch('/informe/evolucion-sectores', 'GET'); |
|
| 64 | - $this->assertResponseStatusCode(200); |
|
| 65 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | - $this->assertModuleName('api'); |
|
| 67 | - $this->assertControllerName(EvolutionReportController::class); |
|
| 68 | - $this->assertControllerClass('EvolutionReportController'); |
|
| 69 | - $this->assertMatchedRouteName('informe-evolucion-sectores'); |
|
| 70 | - |
|
| 71 | - $data = $this->getResponse()->getContent(); |
|
| 72 | - |
|
| 73 | - $this->assertJson($data); |
|
| 74 | - |
|
| 75 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | - |
|
| 77 | - $this->assertArrayHasKey('column_1', $data); |
|
| 78 | - $this->assertArrayHasKey('colores', $data); |
|
| 79 | - $this->assertArrayHasKey('column_2', $data); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - public function testGetSectoralEvolutionActionCanBeAccessed() |
|
| 83 | - { |
|
| 84 | - $this->dispatch('/informe/evolucion-sector/1', 'GET'); |
|
| 85 | - $this->assertResponseStatusCode(200); |
|
| 86 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 87 | - $this->assertModuleName('api'); |
|
| 88 | - $this->assertControllerName(EvolutionReportController::class); |
|
| 89 | - $this->assertControllerClass('EvolutionReportController'); |
|
| 90 | - $this->assertMatchedRouteName('informe-evolucion-sector'); |
|
| 91 | - |
|
| 92 | - $data = $this->getResponse()->getContent(); |
|
| 93 | - |
|
| 94 | - $this->assertJson($data); |
|
| 95 | - |
|
| 96 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 97 | - |
|
| 98 | - $this->assertArrayHasKey('column_1', $data); |
|
| 99 | - $this->assertArrayHasKey('colores', $data); |
|
| 100 | - $this->assertArrayHasKey('column_2', $data); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - public function testGetSectoralEvolutionSubactivityActionCanBeAccessed() |
|
| 104 | - { |
|
| 105 | - $this->dispatch('/informe/evolucion-sector-subactividad/2', 'GET'); |
|
| 106 | - $this->assertResponseStatusCode(200); |
|
| 107 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 108 | - $this->assertModuleName('api'); |
|
| 109 | - $this->assertControllerName(EvolutionReportController::class); |
|
| 110 | - $this->assertControllerClass('EvolutionReportController'); |
|
| 111 | - $this->assertMatchedRouteName('informe-evolucion-sector-subactividad'); |
|
| 112 | - |
|
| 113 | - $data = $this->getResponse()->getContent(); |
|
| 114 | - |
|
| 115 | - $this->assertJson($data); |
|
| 116 | - |
|
| 117 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 118 | - |
|
| 119 | - $this->assertArrayHasKey('column_1', $data); |
|
| 120 | - $this->assertArrayHasKey('groups', $data); |
|
| 121 | - $this->assertArrayHasKey('column_3', $data); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - public function testGetSectoralEvolutionSubactivityCategoryActionCanBeAccessed() |
|
| 125 | - { |
|
| 126 | - $this->dispatch('/informe/evolucion-sector-subactividad-categoria/1/2', 'GET'); |
|
| 127 | - $this->assertResponseStatusCode(200); |
|
| 128 | - $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 129 | - $this->assertModuleName('api'); |
|
| 130 | - $this->assertControllerName(EvolutionReportController::class); |
|
| 131 | - $this->assertControllerClass('EvolutionReportController'); |
|
| 132 | - $this->assertMatchedRouteName('informe-evolucion-sector-subactividad-categoria'); |
|
| 133 | - |
|
| 134 | - $data = $this->getResponse()->getContent(); |
|
| 135 | - |
|
| 136 | - $this->assertJson($data); |
|
| 137 | - |
|
| 138 | - $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function testInvalidRouteDoesNotCrash() |
|
| 142 | - { |
|
| 143 | - $this->dispatch('/invalid/route', 'GET'); |
|
| 144 | - $this->assertResponseStatusCode(404); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // public function testInvalidHttpVerbDoesNotCrash() |
|
| 148 | - // { |
|
| 149 | - // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 150 | - // $this->assertResponseStatusCode(405); |
|
| 151 | - // } |
|
| 19 | + use TestCaseTrait; |
|
| 20 | + |
|
| 21 | + private static $pdo = null; |
|
| 22 | + |
|
| 23 | + private $conn = null; |
|
| 24 | + |
|
| 25 | + public function setUp() |
|
| 26 | + { |
|
| 27 | + $configOverrides = []; |
|
| 28 | + |
|
| 29 | + $this->setApplicationConfig(ArrayUtils::merge( |
|
| 30 | + include __DIR__ . '/../../../../config/application.config.php', |
|
| 31 | + $configOverrides |
|
| 32 | + )); |
|
| 33 | + |
|
| 34 | + $services = $this->getApplicationServiceLocator(); |
|
| 35 | + $config = $services->get('config'); |
|
| 36 | + unset($config['db']); |
|
| 37 | + $services->setAllowOverride(true); |
|
| 38 | + $services->setService('config', $config); |
|
| 39 | + $services->setAllowOverride(false); |
|
| 40 | + |
|
| 41 | + parent::setUp(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + final public function getConnection() |
|
| 45 | + { |
|
| 46 | + if ($this->conn === null) { |
|
| 47 | + if (self::$pdo == null) { |
|
| 48 | + self::$pdo = new PDO('sqlite::memory:'); |
|
| 49 | + } |
|
| 50 | + $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:'); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $this->conn; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + protected function getDataSet() |
|
| 57 | + { |
|
| 58 | + return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + public function testGetWholeSectoralEvolutionActionCanBeAccessed() |
|
| 62 | + { |
|
| 63 | + $this->dispatch('/informe/evolucion-sectores', 'GET'); |
|
| 64 | + $this->assertResponseStatusCode(200); |
|
| 65 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 66 | + $this->assertModuleName('api'); |
|
| 67 | + $this->assertControllerName(EvolutionReportController::class); |
|
| 68 | + $this->assertControllerClass('EvolutionReportController'); |
|
| 69 | + $this->assertMatchedRouteName('informe-evolucion-sectores'); |
|
| 70 | + |
|
| 71 | + $data = $this->getResponse()->getContent(); |
|
| 72 | + |
|
| 73 | + $this->assertJson($data); |
|
| 74 | + |
|
| 75 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 76 | + |
|
| 77 | + $this->assertArrayHasKey('column_1', $data); |
|
| 78 | + $this->assertArrayHasKey('colores', $data); |
|
| 79 | + $this->assertArrayHasKey('column_2', $data); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + public function testGetSectoralEvolutionActionCanBeAccessed() |
|
| 83 | + { |
|
| 84 | + $this->dispatch('/informe/evolucion-sector/1', 'GET'); |
|
| 85 | + $this->assertResponseStatusCode(200); |
|
| 86 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 87 | + $this->assertModuleName('api'); |
|
| 88 | + $this->assertControllerName(EvolutionReportController::class); |
|
| 89 | + $this->assertControllerClass('EvolutionReportController'); |
|
| 90 | + $this->assertMatchedRouteName('informe-evolucion-sector'); |
|
| 91 | + |
|
| 92 | + $data = $this->getResponse()->getContent(); |
|
| 93 | + |
|
| 94 | + $this->assertJson($data); |
|
| 95 | + |
|
| 96 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 97 | + |
|
| 98 | + $this->assertArrayHasKey('column_1', $data); |
|
| 99 | + $this->assertArrayHasKey('colores', $data); |
|
| 100 | + $this->assertArrayHasKey('column_2', $data); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + public function testGetSectoralEvolutionSubactivityActionCanBeAccessed() |
|
| 104 | + { |
|
| 105 | + $this->dispatch('/informe/evolucion-sector-subactividad/2', 'GET'); |
|
| 106 | + $this->assertResponseStatusCode(200); |
|
| 107 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 108 | + $this->assertModuleName('api'); |
|
| 109 | + $this->assertControllerName(EvolutionReportController::class); |
|
| 110 | + $this->assertControllerClass('EvolutionReportController'); |
|
| 111 | + $this->assertMatchedRouteName('informe-evolucion-sector-subactividad'); |
|
| 112 | + |
|
| 113 | + $data = $this->getResponse()->getContent(); |
|
| 114 | + |
|
| 115 | + $this->assertJson($data); |
|
| 116 | + |
|
| 117 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 118 | + |
|
| 119 | + $this->assertArrayHasKey('column_1', $data); |
|
| 120 | + $this->assertArrayHasKey('groups', $data); |
|
| 121 | + $this->assertArrayHasKey('column_3', $data); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + public function testGetSectoralEvolutionSubactivityCategoryActionCanBeAccessed() |
|
| 125 | + { |
|
| 126 | + $this->dispatch('/informe/evolucion-sector-subactividad-categoria/1/2', 'GET'); |
|
| 127 | + $this->assertResponseStatusCode(200); |
|
| 128 | + $this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8'); |
|
| 129 | + $this->assertModuleName('api'); |
|
| 130 | + $this->assertControllerName(EvolutionReportController::class); |
|
| 131 | + $this->assertControllerClass('EvolutionReportController'); |
|
| 132 | + $this->assertMatchedRouteName('informe-evolucion-sector-subactividad-categoria'); |
|
| 133 | + |
|
| 134 | + $data = $this->getResponse()->getContent(); |
|
| 135 | + |
|
| 136 | + $this->assertJson($data); |
|
| 137 | + |
|
| 138 | + $data = Json::decode($data, Json::TYPE_ARRAY); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function testInvalidRouteDoesNotCrash() |
|
| 142 | + { |
|
| 143 | + $this->dispatch('/invalid/route', 'GET'); |
|
| 144 | + $this->assertResponseStatusCode(404); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // public function testInvalidHttpVerbDoesNotCrash() |
|
| 148 | + // { |
|
| 149 | + // $this->dispatch('/informe/distribucion-sectores/2014', 'DELETE'); |
|
| 150 | + // $this->assertResponseStatusCode(405); |
|
| 151 | + // } |
|
| 152 | 152 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $configOverrides = []; |
| 28 | 28 | |
| 29 | 29 | $this->setApplicationConfig(ArrayUtils::merge( |
| 30 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 30 | + include __DIR__.'/../../../../config/application.config.php', |
|
| 31 | 31 | $configOverrides |
| 32 | 32 | )); |
| 33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function getDataSet() |
| 57 | 57 | { |
| 58 | - return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml'); |
|
| 58 | + return $this->createXMLDataSet(__DIR__.'/../fixtures/database.xml'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function testGetWholeSectoralEvolutionActionCanBeAccessed() |