本文整理匯總了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');
}