Commit 9d700764 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Nouvelle infra phpUnit

parent 6b3b98ea
Loading
Loading
Loading
Loading
+1
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,3 +11,4 @@ public/unicaen/*
public/.gitignore
composer.phar
data/fichiers
.phpunit.result.cache
 No newline at end of file
+18 −1
Changes for admin/src/OseAdmin.php: 18 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -286,9 +286,26 @@ class OseAdmin



    public function testsInit()
    {
        // permet de charger l'application
        $this->getContainer();

        // autoload pour les tests
        spl_autoload_register(function(string $class){
            if (str_starts_with($class, 'tests\\')){
                $filename = dirname(dirname(__DIR__)).'/'.str_replace('\\', '/', $class).'.php';
                require_once $filename;
            }
        });

    }



    public function test(string $action)
    {
        $cible = $this->getOseDir() . 'test/'.$action.'.php';
        $cible = $this->getOseDir() . 'tests/'.$action.'.php';

        if (!file_exists($cible)){
            $this->console->printDie("Le fichier $cible n'existe pas");
+9 −1
Changes for bin/ose-test: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -7,4 +7,12 @@ $oa = OseAdmin::getInstance();

$c = $oa->getConsole();

$oa->test($c->getArg(1) ?: 'help');
 No newline at end of file
$action = $c->getArg(1) ?: 'phpunit';

if ('phpunit' == $action){
    $c->exec(dirname(__DIR__).'/vendor/bin/phpunit tests --color=always');
}else{
    // lancement du script demandé
    $oa->testsInit();
    $oa->test($action);
}
 No newline at end of file
+2 −1
Changes for composer.json: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@
        "squizlabs/php_codesniffer"         : "*",
        "phpcompatibility/php-compatibility": "*",
        "phan/phan"                         : "^5.3",
        "phpmd/phpmd"                       : "*"
        "phpmd/phpmd"                       : "*",
        "phpunit/phpunit"                   : "^9"
    },
    "prefer-stable"    : true,
    "config"           : {
+1792 −193

File changed.

Preview size limit exceeded, changes collapsed.

Loading