예제 #1
0
 /**
  * Tests creating a project
  *
  * @return void
  */
 public function testCreateProject()
 {
     $this->visit('/project/create')->seePageIs('/login');
     $this->assertTrue(file_exists($this->testImage));
     // Create and retrieve good project
     $this->tryCreateProject($this->user, 'Test Project', 'Create test please work', 'This is not the body you are looking for. This is not the body you are looking for. This is not the body you are looking for. This is not the body you are looking for. This is not the body you are looking for. ', $this->testImage)->seePageIs('/project/Test Project');
     $entry = App\Project::where('title', '=', 'Test Project')->first();
     $this->assertTrue($entry != null);
     $this->seePageIs($entry->getSlug());
     // Check if image exists
     $imagePath = $this->baseImagePath . '/projects/product' . $entry->id . '.jpg';
     $this->assertTrue(file_exists($imagePath));
     // Delete project (using model's delete function)
     $entry->delete();
     $this->assertTrue(!file_exists($imagePath));
 }
예제 #2
0
 public function testInitializeStoring()
 {
     $user = factory(App\User::class, 'active')->make();
     $this->actingAs($user)->visit('/top10_yandex')->type('Test Project', 'project_name')->type('кошки', 'query[0]')->check('set_dog')->press('Получить Top 10')->seeInDatabase('projects', ['name' => 'Test Project', 'user_id' => $user->id])->seeInDatabase('queries', ['text' => 'кошки'])->assertEquals(App\Project::where('name', 'Test Project')->first()->id, App\Query::where('text', 'кошки')->first()->project_id);
 }