// test $m = LimeMock::create('TestInterface'); // assertions $t->ok($m instanceof TestInterface, 'The mock implements the interface'); $t->ok($m instanceof LimeMockInterface, 'The mock implements "LimeMockInterface"'); // @Test: Namespaced interfaces can be mocked (PHP 5.3) if (version_compare(PHP_VERSION, '5.3', '>=')) { require_once __DIR__ . '/php5.3/TestInterface.php'; // test $m = LimeMock::create('TestNamespace\\TestSubNamespace\\TestInterface'); // assertions $interface = 'TestNamespace\\TestSubNamespace\\TestInterface'; $t->ok($m instanceof $interface, 'The mock implements the interface'); $t->ok($m instanceof LimeMockInterface, 'The mock implements "LimeMockInterface"'); } else { $t->skip(); $t->skip(); } // @Test: Abstract classes can be mocked // test $m = LimeMock::create('TestClassAbstract'); // assertions $t->ok($m instanceof TestClassAbstract, 'The mock inherits the class'); $t->ok($m instanceof LimeMockInterface, 'The mock implements "LimeMockInterface"'); // @Test: Non-existing classes can be mocked $m = LimeMock::create('FoobarClass'); // assertions $t->ok($m instanceof FoobarClass, 'The mock generates and inherits the class'); $t->ok($m instanceof LimeMockInterface, 'The mock implements "LimeMockInterface"'); // @Test: Non-existing namespaced classes can be mocked (PHP 5.3) if (version_compare(PHP_VERSION, '5.3', '>=')) {