/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('driver', function () {
         $db = $this->app['db']->connection()->getPdo();
         return new EloquentDriver($db, $this->app['Str']);
     });
     $this->app->bind('fixture', function () {
         $fixture = Fixture::getInstance();
         $fixture->setDriver($this->app['driver']);
         $fixture->setConfig($this->app['config']->get('fixture-l4::config'));
         return $fixture;
     });
 }
Esempio n. 2
0
 /**
  * Test that the fixture class is able to generate a single instance
  * of itself.
  *
  * @test
  * @return void
  */
 public function itShouldCreateOnlyASingleInstanceOfItself()
 {
     $fixture = Fixture::getInstance();
     $this->assertInstanceOf('Codesleeve\\Fixture\\Fixture', $fixture);
     $this->assertSame($this->fixture, $fixture);
 }
Esempio n. 3
0
 /**
  * Build a fixture instance.
  *
  * @return void
  */
 protected function buildFixture()
 {
     if ($this->fixture) {
         return;
     }
     $this->db = $this->buildDB();
     $this->fixture = Fixture::getInstance();
     $repository = new Standard($this->db);
     $this->fixture->setDriver($repository);
 }
Esempio n. 4
0
 /**
  * Build a fixture instance.
  *
  * @return void
  */
 protected function buildFixture()
 {
     if ($this->fixture) {
         return;
     }
     $this->db = $this->buildDB();
     $str = new Str();
     $this->fixture = Fixture::getInstance();
     $repository = new Eloquent($this->db, $str);
     $this->fixture->setDriver($repository);
     // Bootstrap Eloquent
     $sqliteConnection = new SQLiteConnection($this->db);
     $resolver = new ConnectionResolver(array('sqlite' => $sqliteConnection));
     $resolver->setDefaultConnection('sqlite');
     Model::setConnectionResolver($resolver);
 }
Esempio n. 5
0
 /**
  * Test that the fixture class is able to generate a single instance
  * of itself. 
  * 
  * @test
  * @return void
  */
 public function it_should_create_only_a_single_instance_of_itself()
 {
     $fixture = Fixture::getInstance();
     $this->assertInstanceOf('Codesleeve\\Fixture\\Fixture', $fixture);
     $this->assertSame($this->fixture, $fixture);
 }