/** * @param string $table * * @dataProvider providerTestPersistenceOfTheRecords */ public function testPersistenceOfTheRecords($table) { $loader = new Loader($this->formatTestApplicationPath('database/fixtures')); $seeder = new Seeder($loader); $seeder->seed($table); $data = $loader->loadYmlData($table); $this->assertArrayHasKey('settings', $data); $this->assertArrayHasKey('items', $data); $this->seePersistenceWithoutRelations($table, $data['items'], $data['settings']); $this->seePersistenceWithRelations($table, $data['items'], $data['settings']); }
/** * Seeds the table with fixture data * * @param string $table * @param string $fixturePath * * @throws \Stefanius\LaravelFixtures\Exception\PathNotFoundException */ public static function seed($table, $fixturePath = null) { if (is_null($table) || !is_string($table)) { throw new \InvalidArgumentException('The $table argument has to be a string and may not be NULL.'); } if (!is_null($fixturePath) && !is_dir(base_path($fixturePath))) { throw new PathNotFoundException($fixturePath); } if (is_null($fixturePath) && !is_null(self::$fixturePath)) { $fixturePath = self::$fixturePath; } if (is_null($fixturePath)) { $fixturePath = self::findDefaultFixturePath(); } $loader = new Loader($fixturePath); $seeder = new Seeder($loader, self::$command); $seeder->seed($table); }