protected function addContent() { $faker = Faker\Factory::create(); \DB::table('languages')->truncate(); \Distilleries\Expendable\Models\Language::create(['libelle' => $faker->realText(20), 'iso' => $faker->iso8601, 'not_visible' => false, 'is_default' => false, 'status' => true]); \Distilleries\Expendable\Models\Language::create(['libelle' => $faker->realText(20), 'iso' => $faker->iso8601, 'not_visible' => false, 'is_default' => false, 'status' => false]); }
protected function addContent() { $faker = Faker\Factory::create(); $data = ['libelle' => $faker->realText(20), 'iso' => $faker->iso8601, 'not_visible' => false, 'is_default' => false, 'status' => true]; $result = \Distilleries\Expendable\Models\Language::create($data); $result = \Distilleries\Expendable\Models\Language::find($result->id); return [$data, $result]; }
public function testExportXls() { $faker = Faker\Factory::create(); $data = ['libelle' => str_replace('\'', '', $faker->country), 'iso' => $faker->countryCode, 'not_visible' => false, 'is_default' => true, 'status' => true]; \Distilleries\Expendable\Models\Language::create($data); $dateBegin = date('Y-m-d', time() - 24 * 60 * 60); $dateEnd = date('Y-m-d', time() + 24 * 60 * 60); \File::delete(storage_path('exports')); try { $this->call('POST', action('Admin\\LanguageController@postExport'), ['range' => ['start' => $dateBegin, 'end' => $dateEnd], 'type' => 'Distilleries\\Expendable\\Contracts\\ExcelExporterContract']); } catch (\Maatwebsite\Excel\Exceptions\LaravelExcelException $e) { $this->assertEquals("[ERROR]: Headers already sent", $e->getMessage()); $this->assertFileExists(storage_path('exports/' . $dateBegin . ' ' . $dateEnd . '.xls')); } }
public function run() { Language::create(['libelle' => 'English', 'iso' => 'en', 'status' => true, 'not_visible' => false, 'is_default' => true]); Language::create(['libelle' => 'French', 'iso' => 'fr', 'status' => true, 'not_visible' => true, 'is_default' => true]); }