<?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');
<?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');
<?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');
<?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'));
<?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");
<?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');
<?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");