private function makeBusiness(User $owner) { $business = factory(Business::class)->make(); $business->save(); $business->owners()->attach($owner); return $business; }
/** * Run the database seeds. * * @return void */ public function run() { $dishNames = ['Chicken Parmesano', 'Salad Niçoise', 'Turkey Marco Polo', 'Tuna Marinara', 'Salmon Louis Salad', 'Chicken Kiev', 'Pasta Primavera', 'Stroganoff', 'Duck à l\'orange', 'Spaghetti Carbonara', 'Creme du Barry', 'Turkey Cordon Bleu', 'Salsa Verde', 'Mexican Burrito']; foreach ($dishNames as $dishName) { factory(App\Dish::class)->create(['user_id' => 1, 'name' => $dishName]); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS = 0'); DB::table('cijfer')->truncate(); $toetsen = Toets::all(); //$cijfers = factory(Cijfer::class, count($toetsen)*count($leerlingen))->create(); for ($i = 0; $i < count($toetsen); ++$i) { //dd($toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->leerlingen()->first()); $klas = $toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->code; if (substr($klas, 0, 1) != '5') { continue; } $leerlingen = $toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->leerlingen()->get(); for ($j = 0; $j < count($leerlingen); ++$j) { $cijfer = factory(Cijfer::class, 1)->create(); $cijfer["waarde"] = rand(0, 10); $cijfer["toets_id"] = $toetsen[$i]["id"]; $cijfer["leerling_id"] = $leerlingen[$j]["id"]; $cijfer->save(); } } DB::statement('SET FOREIGN_KEY_CHECKS = 1'); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { factory(App\Event::class, 1000)->create(); factory(App\Steminar::class, 1000)->create(); factory(App\Team::class, 100)->create(); factory(App\User::class, 100)->create(); }
public function setup() { parent::setup(); $todo = factory(\App\Todo::class)->create(); // echo $todo; $this->id = $todo['id']; }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); factory('App\\User', 100)->create(); Model::reguard(); // $this->call(UserTableSeeder::class); }
public function testManufacturerAdd() { $manufacturers = factory(Manufacturer::class, 'manufacturer')->make(); $values = ['name' => $manufacturers->name]; Manufacturer::create($values); $this->tester->seeRecord('manufacturers', $values); }
public function testUploadAvatar() { $user = factory(\App\User::class)->create(); $this->actingAs($user)->visit('/dashboard'); $this->visit('/profile'); $this->call('POST', '/profile/update/avatar', ['avatar' => ' /images/avatar.png', '_token' => csrf_token()]); }
/** * Run the database seeds. * * @return void */ public function run() { for ($i = 0; $i < 100; $i++) { $word = factory(JapaneseWords\Word::class)->make(); $word->save(); } }
public function testVideoUpload() { $user = factory(\App\User::class)->create(); $this->actingAs($user)->visit('/dashboard'); $this->click('Upload Video'); $this->type('Something to watch', 'title')->type('Science', 'category')->type('https://www.youtube.com/watch?v=ssuiqtreiBg', 'url')->type('Some text for the description', 'description')->press('Upload')->see('The video has been successfully uploaded.'); }
public function testVerificationVerify_ReturnsVerifiedResponseValidCodeProvided() { factory(\Legit\Code\Code::class)->create(); $data = ['phone_number' => '27848118111', 'client_user_id' => 1, 'code' => '123456']; $this->post('api/v1/verification/verify', $data)->seeJsonEquals(['status' => 200, 'message' => 'This phone number is verified', 'data' => ['phone_number' => '27848118111', 'client_user_id' => 1]]); $this->assertResponseStatus(200); }
/** * Run the database seeds. * * @return void */ public function run() { // apagar todos os registro da tabela //\CodeProject\Entities\ProjectMember::truncate(); // criar 10 registros na tabela factory(\CodeProject\Entities\ProjectMember::class, 10)->create(); }
public function run() { // refresh migration Artisan::call('migrate:refresh'); // init data // create user $user = factory(App\User::class)->create(); // create categories $categories = factory(App\Category::class, 5)->create(['user_id' => $user->id]); // create tags $tags = factory(App\Tag::class, 10)->create(['user_id' => $user->id]); // create articles factory(App\Article::class, 20)->create(['user_id' => $user->id, 'category_id' => $categories->random()->id])->each(function ($article) use($tags) { $tagids = []; $tags->random(rand(2, 10))->each(function ($tag) use(&$tagids) { array_push($tagids, $tag->id); }); $article->tags()->attach($tagids); }); // create knots factory(App\Knot::class, 10)->create(['user_id' => $user->id])->each(function ($knot) use($tags) { $tagids = []; $tags->random(rand(2, 10))->each(function ($tag) use(&$tagids) { array_push($tagids, $tag->id); }); $knot->tags()->attach($tagids); }); }
/** * */ public function testIndexUri() { $user = factory(App\User::class)->create(); $route = $this->actingAs($user); $route->visit('/points'); $route->seeStatusCode(200); }
public function testShow() { $project = factory(Project::class)->create(); $this->action('GET', 'ProjectsController@show', $project); $this->assertResponseOk(); $this->assertViewHas('project'); }
public function run() { $rules = factory(TeamsScoreType::class)->make()->getProperties(); factory(Nhlpool\PoolType::class, 50)->create()->each(function ($poolType) use($rules) { $poolType->setRules($rules); }); }
public function testProfileUpdate() { $user = factory(\App\User::class)->create(); $this->actingAs($user)->visit('/dashboard'); $this->click('My Profile'); $this->type('testuser', 'username')->type('*****@*****.**', 'email')->type('Test', 'first_name')->type('User', 'last_name')->press('Save Changes')->see('You have successfully updated your profile.'); }
public function testStoreWithIncorrectCredentials() { $user = factory(User::class)->create(['email' => '*****@*****.**']); $this->action('POST', 'Admin\\SessionsController@store', ['email' => $user->email, 'password' => 'foo']); $this->assertRedirectedToRoute('admin.sessions.create'); $this->assertSessionHas('error', 'Your login credentials were invalid.'); }
public function testDeleteExercise() { $exercise = $this->app['auth']->user()->exercises()->save(factory(Exercise::class)->make()); $this->delete('__api/exercises/' . $exercise->id, [], ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $this->assertResponseStatus(204); $this->notSeeInDatabase('exercises', ['id' => $exercise->id, 'deleted_at' => null]); }
/** * Run the database seeds. * * @return void */ public function run() { $fake = Faker\Factory::create(); foreach (Outlet::all() as $outlet) { $customers = $outlet->company->customers; $employees = $outlet->users; $tax = $outlet->tax; $discounts = $outlet->company->discounts; $payments = $outlet->company->payments; //create order $orders = []; foreach (range(1, 100) as $i) { $orders[] = factory(Order::class)->create(['outlet_id' => $outlet->id, 'customer_id' => $customers->random()->id, 'user_id' => $employees->random()->id, 'payment_id' => $payments->random()->id, 'tax_id' => $tax->id, 'discount_id' => $discounts->random()->id]); } foreach ($orders as $order) { $variantIds = $outlet->variants->random(10)->lists('id')->toArray(); $order->variants()->attach($variantIds, ['total' => $fake->numberBetween(10, 100), 'nego' => 0]); } //select random order to void by random employee foreach (range(1, 5) as $i) { factory(Void::class)->create(['user_id' => $employees->random()->id, 'order_id' => $orders[mt_rand(1, 99)]->id]); } //select random order to void by random employee foreach (range(1, 5) as $i) { factory(Debt::class)->create(['order_id' => $orders[mt_rand(1, 99)]->id]); } } }
/** * @test */ public function it_logs_a_user_out() { $this->preparePageContent(); $user = factory('App\\User')->create(); $this->actingAs($user)->visit('admin/logout'); $this->assertFalse(Auth::check(), 'user not logged out'); }
/** * Tests if cart is being created correctly. */ public function testCreationBasedOnUser() { $user = factory('App\\User')->create(); $cart = App\Cart::findByUser($user->id); $this->assertNotEmpty($cart); $user->delete(); }
public function run() { DB::table('users')->truncate(); factory('CodeCommerce\\User')->create(['name' => "Houston", 'email' => '*****@*****.**', 'password' => Hash::make('123456'), 'is_admin' => true, 'endereco' => 'R. Canadá', 'numero' => 73, 'bairro' => 'Jardim Naltilus', 'cidade' => 'Cabo Frio', 'uf' => 'RJ', 'cep' => '28909-170']); //usuario padrao factory('CodeCommerce\\User', 9)->create(); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->truncate(); factory('codeCommerce\\User')->create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'is_admin' => 1]); factory('codeCommerce\\User', 10)->create(); /* User::create([ 'name' => 'Walter', 'email' => '*****@*****.**', 'password' => Hash::make('12345'), ]); $faker = Faker::create(); foreach (range(2,10) as $i){ User::create([ 'name' => $faker->name(), 'email' => $faker->email(), 'password' => Hash::make($faker->word()), ]); } * */ }
public function testDeleteComment() { $this->beUser(); $project = factory('Gitamin\\Models\\Comment')->create(); $this->delete('/api/v1/comments/1'); $this->assertResponseStatus(204); }
/** * @return void */ public function testAuthorStore() { $author = factory(App\Droit\Author\Entities\Author::class)->make(); $this->author->shouldReceive('create')->once()->andReturn($author); $response = $this->call('POST', 'admin/author', ['first_name' => 'Jane', 'last_name' => 'Doe', 'occupation' => 'Test', 'bio' => 'Test', 'photo' => 'jane.jpg', 'rang' => 1]); $this->assertRedirectedTo('admin/author'); }
/** * Run the database seeds. * * @return void */ public function run() { $tags = array(['name' => 'environment', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')], ['name' => 'government', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); // Uncomment the below to run the seeder DB::table('tags')->insert($tags); factory(App\Models\Tag::class, 10)->create(); }
/** * Run the database seeds. * * @return void */ public function run() { factory(CuentasFacturas\User::class)->create(['name' => 'Luigi', 'username' => 'luigi', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'type' => 'administrador', 'remember_token' => str_random(10)]); factory(CuentasFacturas\User::class)->create(['name' => 'Admin 12345', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'type' => 'administrador', 'remember_token' => str_random(10)]); factory(CuentasFacturas\User::class)->create(['name' => 'Diana', 'username' => 'diana', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'type' => 'usuario', 'remember_token' => str_random(10)]); factory(CuentasFacturas\User::class, 25)->create(); }
public function testDestroy() { $post = factory(Post::class)->create(); $this->action('DELETE', 'Admin\\PostsController@destroy', $post); $this->assertRedirectedToRoute('admin.posts.index'); $this->assertEquals(0, Post::count()); }
/** * A basic functional test example. * * @return void */ public function testBasicExample() { $user = factory(\App\User::class)->create(); $this->be($user); $response = $this->call('GET', '/test'); $this->assertEquals(200, $response->status()); }