当前位置: 首页>>代码示例>>PHP>>正文


PHP LimeTest::skip方法代码示例

本文整理汇总了PHP中LimeTest::skip方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeTest::skip方法的具体用法?PHP LimeTest::skip怎么用?PHP LimeTest::skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LimeTest的用法示例。


在下文中一共展示了LimeTest::skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

// 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', '>=')) {
开发者ID:b00giZm,项目名称:lime,代码行数:31,代码来源:LimeMockTest.php


注:本文中的LimeTest::skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。