mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-22 17:36:29 +02:00
Add php-cs-fixer"
This commit is contained in:
parent
9e9cd47b91
commit
508aeb0957
9 changed files with 120 additions and 0 deletions
23
tests/phpunit/bootstrap.php
Executable file
23
tests/phpunit/bootstrap.php
Executable file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
###############
|
||||
# ENVIRONMENT #
|
||||
###############
|
||||
define('ENVIRONMENT', 'test');
|
||||
define('FROM_WEB', false);
|
||||
require_once(__DIR__ . '/descartes/load-environment.php');
|
||||
|
||||
##############
|
||||
# INCLUSIONS #
|
||||
##############
|
||||
//On va inclure l'ensemble des fichiers necessaires
|
||||
require_once(PWD . '/descartes/autoload.php');
|
||||
require_once(PWD . '/vendor/autoload.php');
|
||||
require_once(PWD . '/routes.php');
|
||||
|
||||
#########
|
||||
# MODEL #
|
||||
#########
|
||||
//On va appeler un modèle, est l'initialiser
|
||||
$bdd = Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
|
||||
|
||||
|
0
tests/phpunit/controllers/internals/.keep
Executable file
0
tests/phpunit/controllers/internals/.keep
Executable file
0
tests/phpunit/controllers/publics/.keep
Executable file
0
tests/phpunit/controllers/publics/.keep
Executable file
36
tests/phpunit/descartes/ControllerTest.php
Executable file
36
tests/phpunit/descartes/ControllerTest.php
Executable file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
class ControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $controller;
|
||||
private $fileName;
|
||||
|
||||
protected function setup()
|
||||
{
|
||||
$this->controller = new \Controller();
|
||||
$this->fileName = 'efiuihhaeafiun9864029884IJBoizeefiuh_uh';
|
||||
touch(PWD_TEMPLATES . '/' . $this->fileName . '.php');
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
unlink(PWD_TEMPLATES . '/' . $this->fileName . '.php');
|
||||
}
|
||||
|
||||
public function assertPreConditions()
|
||||
{
|
||||
$this->assertTrue(file_exists(PWD_TEMPLATES . '/' . $this->fileName . '.php'));
|
||||
}
|
||||
|
||||
public function testS()
|
||||
{
|
||||
$textHtml = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href=\"http://example.fr\">avec un lien</a>.</p>";
|
||||
|
||||
$textEscape = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href="http://example.fr">avec un lien</a>.</p>";
|
||||
$textNl2br = "<h1>Mon Text</h1><br />\n<p>Mon paragraphe <a href="http://example.fr">avec un lien</a>.</p>";
|
||||
$textNoEscapeQuotes = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href=\"http://example.fr\">avec un lien</a>.</p>";
|
||||
|
||||
$this->assertEquals($this->controller->s($textHtml, false, true, false), $textEscape);
|
||||
$this->assertEquals($this->controller->s($textHtml, true, true, false), $textNl2br);
|
||||
$this->assertEquals($this->controller->s($textHtml, false, false, false), $textNoEscapeQuotes);
|
||||
}
|
||||
}
|
0
tests/phpunit/modules/.keep
Executable file
0
tests/phpunit/modules/.keep
Executable file
Loading…
Add table
Add a link
Reference in a new issue