mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
Move to raspisms dir
This commit is contained in:
parent
34a6f7de65
commit
40fccf133c
278 changed files with 109 additions and 2020 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
$header = <<<'EOF'
|
||||
This file is part of RaspiSMS.
|
||||
|
||||
(c) Pierre-Lin Bonnemaison <plebwebsas@gmail.com>
|
||||
|
||||
This source file is subject to the GPL-3.0 license that is bundled
|
||||
with this source code in the file LICENSE.
|
||||
EOF;
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude('tests/Fixtures')
|
||||
->in(__DIR__)
|
||||
->append([__DIR__.'/php-cs-fixer'])
|
||||
;
|
||||
|
||||
$config = PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@PHP56Migration' => true,
|
||||
'@PHPUnit60Migration:risky' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@PhpCsFixer:risky' => true,
|
||||
'header_comment' => ['header' => $header],
|
||||
'list_syntax' => ['syntax' => 'long'],
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'mb_str_functions' => true,
|
||||
'method_separation' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'braces' => [
|
||||
'position_after_anonymous_constructs' => 'next',
|
||||
'position_after_control_structures' => 'next',
|
||||
'position_after_functions_and_oop_constructs' => 'next'
|
||||
],
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
||||
|
||||
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
|
||||
if (false !== getenv('FABBOT_IO')) {
|
||||
try {
|
||||
PhpCsFixer\FixerFactory::create()
|
||||
->registerBuiltInFixers()
|
||||
->registerCustomFixers($config->getCustomFixers())
|
||||
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()));
|
||||
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
|
||||
$config->setRules([]);
|
||||
} catch (UnexpectedValueException $e) {
|
||||
$config->setRules([]);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$config->setRules([]);
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
|
@ -1,72 +0,0 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
function help ()
|
||||
{
|
||||
echo 'Usage : ' . __FILE__ . ' <arg>' . "\n" .
|
||||
'Args :' . "\n" .
|
||||
' - help : Show help message.' . "\n" .
|
||||
' - lint : Show coding standards to fix.' . "\n" .
|
||||
' - fix : Fix coding standards.' . "\n";
|
||||
|
||||
exit(100);
|
||||
}
|
||||
|
||||
$lint_commands = [
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar -v --dry-run --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../controllers/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar -v --dry-run --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../models/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar -v --dry-run --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../daemons/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar -v --dry-run --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../adapters/',
|
||||
];
|
||||
|
||||
$fix_commands = [
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../controllers/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../models/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../daemons/',
|
||||
'php ' . __DIR__ . '/php-cs-fixer.phar --config="' . __DIR__ . '/php_cs.config" fix ' . __DIR__ . '/../../adapters/',
|
||||
];
|
||||
|
||||
|
||||
if (count($argv) < 2 || $argv[1] === 'help')
|
||||
{
|
||||
help();
|
||||
}
|
||||
|
||||
if ($argv[1] === 'lint')
|
||||
{
|
||||
echo "######################" . "\n";
|
||||
echo "# SHOW ERRORS TO FIX #" . "\n";
|
||||
echo "######################" . "\n";
|
||||
echo "\n";
|
||||
|
||||
foreach ($lint_commands as $lint_command)
|
||||
{
|
||||
echo "Run : " . $lint_command . " \n";
|
||||
$return = shell_exec($lint_command);
|
||||
echo $return;
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($argv[1] === 'fix')
|
||||
{
|
||||
echo "##############" . "\n";
|
||||
echo "# FIX ERRORS #" . "\n";
|
||||
echo "##############" . "\n";
|
||||
echo "\n";
|
||||
|
||||
foreach ($fix_commands as $fix_command)
|
||||
{
|
||||
echo "Run : " . $fix_command . " \n";
|
||||
$return = shell_exec($fix_command);
|
||||
echo $return;
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
echo "Invalid arg : " . $argv[1] . "\n";
|
||||
help();
|
|
@ -1,5 +0,0 @@
|
|||
parameters:
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
|
||||
ignoreErrors:
|
||||
- '#Constant RASPISMS_[a-zA-Z0-9\\_]+ not found.#'
|
Binary file not shown.
|
@ -1,49 +0,0 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
function help ()
|
||||
{
|
||||
echo 'Usage : ' . __FILE__ . ' <arg> [level 0-7]' . "\n" .
|
||||
'Args :' . "\n" .
|
||||
' - help : Show help message.' . "\n" .
|
||||
' - analyse : Analyse code with phpstan.' . "\n";
|
||||
|
||||
exit(100);
|
||||
}
|
||||
|
||||
$analyse_commands = [
|
||||
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../controllers/',
|
||||
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../models/',
|
||||
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../adapters/',
|
||||
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../daemons/',
|
||||
];
|
||||
|
||||
|
||||
if (count($argv) < 2 || $argv[1] === 'help')
|
||||
{
|
||||
help();
|
||||
}
|
||||
|
||||
$level = $argv[2] ?? 0;
|
||||
|
||||
if ($argv[1] === 'analyse')
|
||||
{
|
||||
echo "######################" . "\n";
|
||||
echo "# SHOW ERRORS TO FIX #" . "\n";
|
||||
echo "######################" . "\n";
|
||||
echo "\n";
|
||||
|
||||
foreach ($analyse_commands as $analyse_command)
|
||||
{
|
||||
$analyse_command .= ' --level=' . $level;
|
||||
|
||||
echo "Run : " . $analyse_command . " \n";
|
||||
$return = shell_exec($analyse_command);
|
||||
echo $return;
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
echo "Invalid arg : " . $argv[1] . "\n";
|
||||
help();
|
|
@ -1,23 +0,0 @@
|
|||
<?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);
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue