本文整理汇总了PHP中Illuminate\Contracts\Container\Container::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::shouldReceive方法的具体用法?PHP Container::shouldReceive怎么用?PHP Container::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Container\Container
的用法示例。
在下文中一共展示了Container::shouldReceive方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_cant_extend_with_an_invalid_class
public function test_cant_extend_with_an_invalid_class()
{
$this->registry->shouldReceive('getManager')->once()->with('default')->andReturn($this->em);
$this->container->shouldReceive('make')->once()->with(InvalidDoctrineExtender::class)->andReturn(new InvalidDoctrineExtender());
$this->setExpectedException(InvalidArgumentException::class);
$this->manager->extend('default', InvalidDoctrineExtender::class);
}
示例2: test_can_set_route
public function test_can_set_route()
{
$urlMock = m::mock('Illuminate\\Contracts\\Routing\\UrlGenerator');
$urlMock->shouldReceive('route')->andReturn('url');
$this->container->shouldReceive('make')->andReturn($urlMock);
$this->routeable->route('route');
$this->assertEquals('url', $this->routeable->getUrl());
}
示例3: mockContainerMake
protected function mockContainerMake($name = null, $weight = null)
{
$mock = m::mock('Maatwebsite\\Sidebar\\Item');
$mock->shouldReceive('name');
$mock->shouldReceive('getName')->andReturn($name);
$mock->shouldReceive('getWeight')->andReturn($weight);
$this->container->shouldReceive('make')->with('Maatwebsite\\Sidebar\\Item')->andReturn($mock);
return $mock;
}
示例4: test_driver_can_return_a_given_driver
public function test_driver_can_return_a_given_driver()
{
$this->app->shouldReceive('resolve')->andReturn(new Yaml($this->cache));
$this->assertInstanceOf(Yaml::class, $this->manager->driver('yaml'));
}
示例5: test_driver_can_return_a_given_driver
public function test_driver_can_return_a_given_driver()
{
$config = m::mock(Repository::class);
$this->app->shouldReceive('resolve')->andReturn(new FileCacheProvider($config));
$this->assertInstanceOf(FileCacheProvider::class, $this->manager->driver());
}
示例6: enableLaravelNamingStrategy
protected function enableLaravelNamingStrategy()
{
$strategy = m::mock(LaravelNamingStrategy::class);
$this->container->shouldReceive('make')->with(LaravelNamingStrategy::class)->once()->andReturn($strategy);
$this->configuration->shouldReceive('setNamingStrategy')->once()->with($strategy);
}
示例7: test_driver_can_return_a_given_driver
public function test_driver_can_return_a_given_driver()
{
$this->app->shouldReceive('resolve')->andReturn((new SqliteConnection($this->config))->resolve());
$this->assertTrue(is_array($this->manager->driver('sqlite')));
$this->assertContains('pdo_sqlite', $this->manager->driver());
}