示例#1
0
 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);
 }
 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());
 }
 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
0
 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
0
 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
0
 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
0
 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());
 }