Skip to content

Commit

Permalink
Merge 6a11fdd into dca4c37
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Nov 10, 2016
2 parents dca4c37 + 6a11fdd commit 730f14e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
8 changes: 6 additions & 2 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@

Router::plugin(
'Sitemap',
['path' => '/sitemap'],
['path' => '/'],
function ($routes) {
$routes->extensions(['xml']);
$routes->fallbacks('DashedRoute');
$routes->connect('/sitemap', [
'controller' => 'Sitemaps',
'plugin' => 'Sitemap',
'action' => 'index'
]);
}
);
21 changes: 21 additions & 0 deletions tests/App/Template/Layout/default.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<?= $this->Html->charset() ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
<?= $this->fetch('title') ?>
</title>
<?= $this->Html->meta('icon') ?>

<?= $this->fetch('meta') ?>
<?= $this->fetch('css') ?>
<?= $this->fetch('script') ?>
</head>
<body>
<?= $this->Flash->render() ?>
<div class="container clearfix">
<?= $this->fetch('content') ?>
</div>
</body>
</html>
6 changes: 6 additions & 0 deletions tests/TestCase/Controller/SitemapsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,10 @@ public function testIndexWithModels() {

$Controller->index();
}

public function testIndexAccess() {
$this->get('/sitemap.xml');

$this->assertResponseOk();
}
}
11 changes: 8 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
define('TMP', ROOT . DS . 'tmp' . DS);
define('LOGS', TMP . 'logs' . DS);
define('CACHE', TMP . 'cache' . DS);
define('APP', sys_get_temp_dir());
define('APP_DIR', 'src');
define('APP_DIR', 'App');
define('APP', ROOT . DS . 'tests' . DS . APP_DIR . DS);
define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp');
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . APP_DIR . DS);
define('CAKE', CORE_PATH . 'src' . DS);

define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
define('CONFIG', dirname(__FILE__) . DS . 'config' . DS);
Expand All @@ -20,6 +20,9 @@
Cake\Core\Configure::write('App', [
'namespace' => 'App',
'encoding' => 'UTF-8',
'paths' => [
'templates' => [APP . 'Template' . DS],
],
]);
Cake\Core\Configure::write('debug', true);

Expand Down Expand Up @@ -74,4 +77,6 @@
'cacheMetadata' => true,
]);

Cake\Routing\DispatcherFactory::add('Routing');

class_alias('Cake\Controller\Controller', 'App\Controller\AppController');
8 changes: 6 additions & 2 deletions tests/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
use Cake\Routing\Router;

Router::scope('/', function ($routes) {
$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);
$routes->connect('/pages/view/:id', [
'controller' => 'Pages',
'action' => 'view',
], ['pass' => ['id']]);
});

require ROOT . DS . 'config/routes.php';

0 comments on commit 730f14e

Please sign in to comment.