本文整理汇总了PHP中org_tubepress_impl_ioc_IocContainer::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP org_tubepress_impl_ioc_IocContainer::setInstance方法的具体用法?PHP org_tubepress_impl_ioc_IocContainer::setInstance怎么用?PHP org_tubepress_impl_ioc_IocContainer::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org_tubepress_impl_ioc_IocContainer
的用法示例。
在下文中一共展示了org_tubepress_impl_ioc_IocContainer::setInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
self::$_mockCache = array();
$ioc = \Mockery::mock('org_tubepress_api_ioc_IocService');
$ioc->shouldReceive('get')->zeroOrMoreTimes()->andReturnUsing(function ($className) {
if (!array_key_exists($className, TubePressUnitTest::$_mockCache)) {
org_tubepress_impl_classloader_ClassLoader::loadClass($className);
$mock = \Mockery::mock($className);
TubePressUnitTest::$_mockCache[$className] = $mock;
if (!is_a($mock, $className)) {
TubePressUnitTest::fail("Failed to built mock of {$className}");
}
}
return TubePressUnitTest::$_mockCache[$className];
});
org_tubepress_impl_ioc_IocContainer::setInstance($ioc);
}
示例2: testCustomContainer
function testCustomContainer()
{
org_tubepress_impl_ioc_IocContainer::setInstance(new FakeIocService());
$result = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->assertTrue(is_a($result, 'FakeIocService'));
}