Init du projet
This commit is contained in:
51
module/Karting/config/module.config.php
Normal file
51
module/Karting/config/module.config.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Application;
|
||||
|
||||
use Zend\Router\Http\Literal;
|
||||
use Zend\Router\Http\Segment;
|
||||
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||
|
||||
return [
|
||||
'router' => [
|
||||
'routes' => [
|
||||
'karting' => [
|
||||
'type' => Literal::class,
|
||||
'options' => [
|
||||
'route' => '/karting',
|
||||
'defaults' => [
|
||||
'controller' => Controller\IndexController::class,
|
||||
'action' => 'index',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
],
|
||||
'controllers' => [
|
||||
'factories' => [
|
||||
Controller\IndexController::class => InvokableFactory::class,
|
||||
],
|
||||
],
|
||||
'view_manager' => [
|
||||
'display_not_found_reason' => true,
|
||||
'display_exceptions' => true,
|
||||
'doctype' => 'HTML5',
|
||||
'not_found_template' => 'error/404',
|
||||
'exception_template' => 'error/index',
|
||||
'template_map' => [
|
||||
'layout/layout' => __DIR__ . '/../view/layout/layout.tpl',
|
||||
'application/index/index' => __DIR__ . '/../view/application/index/index.tpl',
|
||||
'error/404' => __DIR__ . '/../view/error/404.tpl',
|
||||
'error/index' => __DIR__ . '/../view/error/index.tpl',
|
||||
],
|
||||
'template_path_stack' => [
|
||||
__DIR__ . '/../view',
|
||||
],
|
||||
],
|
||||
];
|
20
module/Karting/src/Controller/IndexController.php
Normal file
20
module/Karting/src/Controller/IndexController.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Karting\Controller;
|
||||
|
||||
use Zend\Mvc\Controller\AbstractActionController;
|
||||
use Zend\View\Model\JsonModel;
|
||||
use Zend\View\Model\ViewModel;
|
||||
|
||||
class IndexController extends AbstractActionController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
return new ViewModel();
|
||||
}
|
||||
}
|
18
module/Karting/src/Module.php
Normal file
18
module/Karting/src/Module.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Karting;
|
||||
|
||||
class Module
|
||||
{
|
||||
const VERSION = '3.0.3-dev';
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return include __DIR__ . '/../config/module.config.php';
|
||||
}
|
||||
}
|
53
module/Karting/test/Controller/IndexControllerTest.php
Normal file
53
module/Karting/test/Controller/IndexControllerTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace ApplicationTest\Controller;
|
||||
|
||||
use Application\Controller\IndexController;
|
||||
use Zend\Stdlib\ArrayUtils;
|
||||
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
|
||||
|
||||
class IndexControllerTest extends AbstractHttpControllerTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
// The module configuration should still be applicable for tests.
|
||||
// You can override configuration here with test case specific values,
|
||||
// such as sample view templates, path stacks, module_listener_options,
|
||||
// etc.
|
||||
$configOverrides = [];
|
||||
|
||||
$this->setApplicationConfig(ArrayUtils::merge(
|
||||
include __DIR__ . '/../../../../config/application.config.php',
|
||||
$configOverrides
|
||||
));
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testIndexActionCanBeAccessed()
|
||||
{
|
||||
$this->dispatch('/', 'GET');
|
||||
$this->assertResponseStatusCode(200);
|
||||
$this->assertModuleName('application');
|
||||
$this->assertControllerName(IndexController::class); // as specified in router's controller name alias
|
||||
$this->assertControllerClass('IndexController');
|
||||
$this->assertMatchedRouteName('home');
|
||||
}
|
||||
|
||||
public function testIndexActionViewModelTemplateRenderedWithinLayout()
|
||||
{
|
||||
$this->dispatch('/', 'GET');
|
||||
$this->assertQuery('.container .jumbotron');
|
||||
}
|
||||
|
||||
public function testInvalidRouteDoesNotCrash()
|
||||
{
|
||||
$this->dispatch('/invalid/route', 'GET');
|
||||
$this->assertResponseStatusCode(404);
|
||||
}
|
||||
}
|
5
module/Karting/view/application/index/index.tpl
Normal file
5
module/Karting/view/application/index/index.tpl
Normal file
@@ -0,0 +1,5 @@
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
|
||||
|
||||
<section class="signin-container col-lg-6 col-md-6 col-xs-12" style="position: absolute; top: 0;bottom: 0;left: 0;">
|
||||
|
||||
</section>
|
Reference in New Issue
Block a user