Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR-4 e PHP Unit #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 7 additions & 4 deletions application/controller/Application.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
require_once 'model/MySQLTaskConnector.php';
require_once 'model/TaskRepository.php';
require_once 'view/MainView.php';
require_once 'view/TaskFormView.php';

namespace App\controller;

use App\model\MySQLTaskConnector;
use App\model\TaskRepository;
use App\view\MainView;
use App\view\TaskFormView;

/**
* Controlador da aplicação, esse participante receberá as
Expand Down
6 changes: 5 additions & 1 deletion application/model/MySQLTaskConnector.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php
require_once 'model/TaskConnector.php';

namespace App\model;

use App\model\TaskConnector;
use PDO;

/**
* Conector MySQL para armazenamento de tarefas
Expand Down
3 changes: 3 additions & 0 deletions application/model/Task.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

namespace App\model;

/**
* Entidade que representa uma tarefa
*/
Expand Down
2 changes: 2 additions & 0 deletions application/model/TaskConnector.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

namespace App\model;
/**
* Interface para definição de um conector com o mecanismo
* de armazenamento de tarefas.
Expand Down
5 changes: 4 additions & 1 deletion application/model/TaskRepository.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'model/Task.php';

namespace App\model;

use App\model\Task;

/**
* Implementação das regras de negócio referentes a lista
Expand Down
24 changes: 24 additions & 0 deletions application/test/TestComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace test;

use PHPUnit_Framework_TestCase;

class TestComponent extends PHPUnit_Framework_TestCase {

/**
* @dataProvider listaDeValores
*/
public function testVerificaNumeroDeComponentes($valor, $esperado)
{
$this->assertEquals($esperado, $valor);
}

public function listaDeValores()
{
return array(
array(10, 10),
array(100, 500)
);
}
}
10 changes: 6 additions & 4 deletions application/view/AbstractView.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php
require_once 'view/View.php';
require_once 'view/gui/Anchor.php';
require_once 'view/gui/Heading.php';
require_once 'view/gui/Panel.php';

namespace App\view;

use App\view\View;
use App\view\gui\Anchor;
use App\view\gui\Panel;

/**
* Base para implementação de uma View. Essa classe implementa
Expand Down
7 changes: 5 additions & 2 deletions application/view/MainView.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
require_once 'view/AbstractView.php';
require_once 'view/gui/task/TaskList.php';

namespace App\view;

use App\view\AbstractView;
use App\view\gui\task\TaskList;

/**
* Implementação da View principal da lista de tarefas.
Expand Down
11 changes: 7 additions & 4 deletions application/view/TaskFormView.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
require_once 'view/AbstractView.php';
require_once 'view/gui/Form.php';
require_once 'view/gui/Input.php';
require_once 'view/gui/Label.php';

namespace App\view;

use App\view\AbstractView;
use App\view\gui\Form;
use App\view\gui\Input;
use App\view\gui\Label;

/**
* View de criação e edição de tarefas
Expand Down
3 changes: 3 additions & 0 deletions application/view/View.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

namespace App\view;

/**
* Interface para definição da camada de apresentação onde,
* através de uma interface, o usuário pode interagir com
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Anchor.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um componente de interface de usuário que
Expand Down
7 changes: 5 additions & 2 deletions application/view/gui/Button.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
require_once 'view/gui/Component.php';
require_once 'view/gui/Text.php';

namespace App\view\gui;

use App\view\gui\Component;
use App\view\gui\Text;

/**
* Implementação de um elemento de interface de usuário
Expand Down
3 changes: 3 additions & 0 deletions application/view/gui/Component.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

namespace App\view\gui;

/**
* Interface para definição de um componente de interface
* de usuário. Essa classe é a base para a criação de
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Form.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um componente de interface de usuário que representa
Expand Down
7 changes: 5 additions & 2 deletions application/view/gui/Heading.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
require_once 'view/gui/Component.php';
require_once 'view/gui/Text.php';

namespace App\view\gui;

use App\view\gui\Component;
use App\view\gui\Text;

/**
* Implementação de um elemento de interface de usuário que
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Input.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um elemento de interface de usuário que representa
Expand Down
7 changes: 5 additions & 2 deletions application/view/gui/Label.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
require_once 'view/gui/Component.php';
require_once 'view/gui/Text.php';

namespace App\view\gui;

use App\view\gui\Component;
use App\view\gui\Text;

/**
* Implementação de um componente de interface de usuário que
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/ListItem.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Elemento de interface de usuário que representa um item
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Panel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um componente de interface de usuário
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Span.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um elemento de interface de usuário
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/Text.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Implementação de um texto que será exibido na marcação
Expand Down
5 changes: 4 additions & 1 deletion application/view/gui/UnorderedList.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once 'view/gui/Component.php';

namespace App\view\gui;

use App\view\gui\Component;

/**
* Componente de interface de usuário que representa uma lista
Expand Down
9 changes: 6 additions & 3 deletions application/view/gui/task/TaskList.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
require_once 'view/gui/UnorderedList.php';
require_once 'view/gui/ListItem.php';
require_once 'view/gui/Span.php';

namespace App\view\gui\task;

use App\view\gui\UnorderedList;
use App\view\gui\ListItem;
use App\view\gui\Span;

/**
* Implementação de uma lista de tarefas
Expand Down
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"require": {
"php": ">5.4"
},

"require-dev": {
"phpunit/phpunit": "4.6.*"
},

"autoload": {
"psr-4": {
"App\\": "application"
}
}
}
Loading