コード例 #1
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->comment('initial condition');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
$t->comment('load plugins');
try {
    $threw = false;
    $t->loadPlugins(array($t, $t));
} catch (Exception $e) {
    $threw = true;
    $t->is($e->getMessage(), "plugin name must be string: object", "Exception message is 'plugin name must be string: object'");
}
$t->ok($threw === true, 'threw Exception');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
try {
    $threw = false;
    $t->loadPlugins(array('none', 'nothing'));
} catch (Exception $e) {
    $threw = true;
    $t->is($e->getMessage(), "class file not found: lime/plugin/none.php", "Exception message is 'class file not found: lime/plugin/none.php'");
}
$t->ok($threw === true, 'threw Exception');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
$t->ok($t->loadPlugins(array('exception', 'strict')), 'load exception plugin');
$t->is_deeply($t->listPlugins(), array('lime_plugin_exception', 'lime_plugin_strict'), 'exception plugin loaded');
コード例 #2
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->comment('undefined method called');
try {
    $threw = false;
    $t->none();
} catch (Exception $e) {
    $threw = true;
    $t->is($e->getMessage(), "undefined method: none", "Exception message is 'undefined method: none'");
}
$t->ok($threw === true, 'threw Exception');
コード例 #3
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->comment('load plugin');
$t->ok($t->loadPlugins('exception'), 'load exception plugin');
$t->comment('throws_ok');
$t->throws_ok(array(), 'throw new Exception("hoge");');
$t->throws_ok(array(), 'throw new Exception("hoge");', 'hoge');
$t->throws_ok(array(), 'throw new ErrorException("hoge");', 'ErrorException');
コード例 #4
0
ファイル: initialize.php プロジェクト: nekoya/SmartCSS
<?php

require 'lime/pluggable.php';
require dirname(__FILE__) . '/../libs/SmartCSS.class.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->loadPlugins(array('exception', 'strict'));
コード例 #5
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->loadPlugins('strict');
$t->comment('failure tests');
$t->comment('true');
$t->true(1, "1 === true");
$t->true('1', "'1' === true");
$t->comment('false');
$t->false(0, "0 === false");
$t->false('0', "'0' === false");
$t->false(null, "null === false");
$t->comment('is strict');
$t->iss(1, '1', "1 === '1'");
$t->iss(1, true, "1 === true");
コード例 #6
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->comment('initial condition');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
$t->comment('load a plugin');
try {
    $threw = false;
    $t->loadPlugins($t);
} catch (Exception $e) {
    $threw = true;
    $t->is($e->getMessage(), "plugin name must be string: object", "Exception message is 'plugin name must be string: object'");
}
$t->ok($threw === true, 'threw Exception');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
try {
    $threw = false;
    $t->loadPlugins('none');
} catch (Exception $e) {
    $threw = true;
    $t->is($e->getMessage(), "class file not found: lime/plugin/none.php", "Exception message is 'class file not found: lime/plugin/none.php'");
}
$t->ok($threw === true, 'threw Exception');
$t->is_deeply($t->listPlugins(), array(), 'no plugin loaded');
$t->ok($t->loadPlugins('exception'), 'load exception plugin');
$t->is_deeply($t->listPlugins(), array('lime_plugin_exception'), 'exception plugin loaded');
コード例 #7
0
<?php

require dirname(__FILE__) . '/../lib/lime/pluggable.php';
$t = new lime_test_pluggable();
$t->output = new lime_output_color();
$t->comment('load plugin');
$t->ok($t->loadPlugins('strict'), 'load strict plugin');
$t->comment('true');
$t->true(true, 'true');
$t->comment('false');
$t->false(false, 'false');
$t->comment('is strict');
$t->iss(1, 1, '1 is 1 as strict');
$t->comment('isnt strict');
$t->isnts(1, true, '1 isnt true as strict');
$t->isnts(1, '1', "1 isnt '1' as strict");
$t->isnts('', null, "'' isnt null as strict");