/** * 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); }
/** * 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; }); }
/** * 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); }
/** * Test that fake fixture data (using the Faker library) can be generated. * The desired behavior is that the 'fake' method of Fixture will act as a proxy * to the Faker library. * * @test * @return void */ public function itShouldAbleToGenerateFakeFixtureData() { $word = Fixture::fake('word'); $number = Fixture::fake('numberBetween', 1, 1); $this->assertInternalType('string', $word); $this->assertEquals(1, $number); }
/** * Test that fake fixture data (using the Faker library) can be generated. * The desired behavior is that the 'fake' method of Fixture will act as a proxy * to the Faker library. * * @test * @return void */ public function it_should_able_to_generate_fake_fixture_data() { $word = Fixture::fake('word'); $number = Fixture::fake('randomNumber', 1, 1); $this->assertInternalType('string', $word); $this->assertEquals(1, $number); }