Skip to content

Instantly share code, notes, and snippets.

View eminetto's full-sized avatar
:octocat:
always learning

Elton Minetto eminetto

:octocat:
always learning
View GitHub Profile
<div class="actions clearfix">
<div class="btns">
<a class="btn submit" href="/admin/index/save" title="Criar Post">Criar Post</a>
</div>
</div>
<label class="divisor"><span>Lista de Posts</span></label>
<table class="datatable">
<thead>
<tr>
<th>Título</th>
<?php echo $this->doctype(); ?>
<html lang="en">
<head>
<meta charset="utf-8">
<?php echo $this->headTitle('ZF2 '. $this->translate('Skeleton Application'))->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0') ?>
<!-- Le styles -->
/**
* Testa a página inicial, que deve mostrar os posts
*/
public function testIndexAction()
{
// Cria posts para testar
$postA = $this->addPost();
$postB = $this->addPost();
// Invoca a rota index
/**
* Mostra os posts cadastrados
* @return void
*/
public function indexAction()
{
$post = $this->getTable('Application\Model\Post');
$sql = $post->getSql();
$select = $sql->select();
<?php
// module/Admin/config/module.config.php:
return array(
'controllers' => array( //add module controllers
'invokables' => array(
'Admin\Controller\Index' => 'Admin\Controller\IndexController',
),
),
<?php
//queries used by tests
return array(
'posts' => array(
'create' => 'CREATE TABLE if not exists posts (
id INT NOT NULL AUTO_INCREMENT ,
title VARCHAR(250) NOT NULL ,
description TEXT NOT NULL ,
post_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (id) )
<?php
namespace Admin\Model;
use Core\Test\ModelTestCase;
use Admin\Model\User;
use Zend\InputFilter\InputFilterInterface;
/**
* @group Model
*/
<?php
namespace Admin\Service;
use DateTime;
use Core\Test\ServiceTestCase;
use Admin\Model\User;
use Core\Model\EntityException;
use Zend\Authentication\AuthenticationService;
/**
<?php
namespace Admin\Service;
use Core\Service\Service;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Adapter\DbTable as AuthAdapter;
use Zend\Db\Sql\Select;
/**
* Serviço responsável pela autenticação da aplicação
//ou adicionar no array do module.config.php (ou outro config)
'service_manager' => array(
'factories' => array(
'Session' => function($sm) {
return new Zend\Session\Container('ZF2napratica');
},
'Admin\Service\Auth' => function($sm) {