Example #1
0
 public function setImage($value)
 {
     if (is_object($value) && $value->getClassName() == 'Image') {
         $id = $value->getId();
         parent::setImage(Multilingual::set(parent::getImage(), $id));
     }
 }
Example #2
0
    echo "input message:                                                      {$input_message}\n";
    if ($result !== $output) {
        echo "Returned serial does not match\n";
        $pass = false;
    }
    return $pass;
};
$tests['Type check'] = function () {
    $pass = true;
    $c = new stdClass();
    $c->my = 'MY';
    $c->std = 'STD';
    $c->class = 'CLASS';
    $battery = array(null, true, false, -1, 0, 1, -1.0, 0.0, 1.0, "text string", array("this", "is", "an", "array"), $c);
    foreach ($battery as $input) {
        $raw = Multilingual::set('', $input);
        $output = Multilingual::get($raw);
        $type_ok = gettype($input) === gettype($output);
        if ($type_ok) {
            echo gettype($input) . "\tOK\n";
        } else {
            echo gettype($input) . "\tERR\n";
        }
        if (!$type_ok) {
            echo "^^^^ Type does not match \n";
            $pass = false;
        }
    }
    return $pass;
};
$tests['Performance json_encode vs serialize'] = function () {