本文整理汇总了PHP中Illuminate\Container\Container::offsetSet方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::offsetSet方法的具体用法?PHP Container::offsetSet怎么用?PHP Container::offsetSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Container\Container
的用法示例。
在下文中一共展示了Container::offsetSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDIMultiInstance
public function testDIMultiInstance()
{
$key1 = 'hello';
$value1 = new \stdClass();
$key2 = 'Night';
$value2 = new \stdClass();
//register key1 in first instance, key2 in second instance
$this->illuminate->offsetSet($key1, $value1);
$illuminate = new IlluminateContainer();
$illuminate->offsetSet($key2, $value2);
$adapter = new IlluminateAdapter($illuminate);
$this->container->provider($adapter);
$this->assertEquals($value1, $this->container->get($key1));
$this->assertEquals($value2, $this->container->get($key2));
}
示例2: it_should_able_to_set_value_to_container
public function it_should_able_to_set_value_to_container(Container $container)
{
$container->offsetSet('Test', 'Test')->shouldBeCalled();
$this->offsetSet('Test', 'Test');
}