Esempio n. 1
0
 public static function Summon($container, $module)
 {
     $voco = __DIR__ . '/' . $container . '/' . $module . '.util';
     Verbum::Voco('Verbum::breath', $voco);
 }
Esempio n. 2
0
<?php

include_once __DIR__ . '/../verbum-php/core/Verbum.php';
include_once __DIR__ . '/../src/Cube.php';
use Verbum\Core\Verbum;
Verbum::Voco('Util::unittest!feedback', array('message' => "BEGIN TEST FOR CUBE"));
$side = 25;
$obj = new Shapes\Cube($side);
Verbum::Voco('Util::unittest!feedback', array('message' => "Instantiated cube with side length of {$side}?", 'assert' => get_class($obj) == 'Shapes\\Cube'));
$circumference = $side * 12;
Verbum::Voco('Util::unittest!feedback', array('message' => "Circumference is {$circumference}?", 'assertwith' => $circumference, 'gotvalue' => $obj->perimeter()));
$area = 6 * pow($side, 2);
Verbum::Voco('Util::unittest!feedback', array('message' => "Area is {$area}?", 'assertwith' => $area, 'gotvalue' => $obj->area()));
$volume = pow($side, 3);
Verbum::Voco('Util::unittest!feedback', array('message' => "Volume is {$volume}?", 'assertwith' => $volume, 'gotvalue' => $obj->volume()));
Verbum::Voco('Util::unittest!feedback', array('message' => "TEST FOR CUBE SUCCESS!"));
Verbum::Voco('Util::unittest!feedback', array('message' => "----"));
        if ($vars['assert']) {
            echo " yes" . $nextLine;
        } else {
            echo " no" . $nextLine;
            die;
        }
        return;
    }
    echo $nextLine;
});
//TEST VOCO in commandline
if (!isset($argv)) {
    $argv = null;
}
call_user_func(function () use($argv) {
    if (is_null($argv)) {
        return;
    }
    global $_SESSION;
    global $_SERVER;
    global $_POST;
    if (basename($argv[0]) != basename(__FILE__)) {
        return;
    }
    Verbum::Voco('Util::unittest!' . basename(__FILE__), array('message' => "Stating Unit Test"));
    $testTotal = 1 + 1;
    Verbum::Voco('Util::unittest!' . basename(__FILE__), array('message' => "Is 1 + 1 equals 2?", 'assert' => $testTotal == 2));
    $testTotal = 10;
    // introduce bug
    Verbum::Voco('Util::unittest!' . basename(__FILE__), array('message' => "Is 1 * 3 equals 3?", 'assert' => $testTotal == 3));
});