Update attachment controller test.

This commit is contained in:
James Cole
2017-02-12 11:53:04 +01:00
parent e15bb05823
commit ac63a082aa

View File

@@ -23,10 +23,10 @@ class AttachmentControllerTest extends TestCase
public function testDelete() public function testDelete()
{ {
$this->be($this->user()); $this->be($this->user());
$this->call('GET', route('attachments.delete', [1])); $response = $this->get(route('attachments.delete', [1]));
$this->assertResponseStatus(200); $response->assertStatus(200);
// has bread crumb // has bread crumb
$this->see('<ol class="breadcrumb">'); $response->assertSee('<ol class="breadcrumb">');
} }
/** /**
@@ -39,9 +39,9 @@ class AttachmentControllerTest extends TestCase
$repository = $this->mock(AttachmentRepositoryInterface::class); $repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
$this->be($this->user()); $this->be($this->user());
$this->call('post', route('attachments.destroy', [1])); $response = $this->post(route('attachments.destroy', [1]));
$this->assertResponseStatus(302); $response->assertStatus(302);
$this->assertSessionHas('success'); $response->assertSessionHas('success');
} }
/** /**
@@ -54,10 +54,10 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.'); $repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.');
$this->be($this->user()); $this->be($this->user());
$this->call('GET', route('attachments.download', [1])); $response = $this->get(route('attachments.download', [1]));
$this->assertResponseStatus(200); $response->assertStatus(200);
// has bread crumb // has bread crumb
$this->see('This is attachment number one.'); $response->assertSee('This is attachment number one.');
} }
/** /**
@@ -66,10 +66,10 @@ class AttachmentControllerTest extends TestCase
public function testEdit() public function testEdit()
{ {
$this->be($this->user()); $this->be($this->user());
$this->call('GET', route('attachments.edit', [1])); $response = $this->get(route('attachments.edit', [1]));
$this->assertResponseStatus(200); $response->assertStatus(200);
// has bread crumb // has bread crumb
$this->see('<ol class="breadcrumb">'); $response->assertSee('<ol class="breadcrumb">');
} }
/** /**
@@ -78,8 +78,8 @@ class AttachmentControllerTest extends TestCase
public function testPreview() public function testPreview()
{ {
$this->be($this->user()); $this->be($this->user());
$this->call('GET', route('attachments.preview', [1])); $response = $this->get(route('attachments.preview', [1]));
$this->assertResponseStatus(200); $response->assertStatus(200);
} }
/** /**
@@ -95,17 +95,17 @@ class AttachmentControllerTest extends TestCase
]; ];
$this->be($this->user()); $this->be($this->user());
$this->call('post', route('attachments.update', [1]), $data); $response = $this->post(route('attachments.update', [1]), $data);
$this->assertResponseStatus(302); $response->assertStatus(302);
$this->assertSessionHas('success'); $response->assertSessionHas('success');
// view should be updated // view should be updated
$this->be($this->user()); $this->be($this->user());
$this->call('GET', route('attachments.edit', [1])); $response = $this->get(route('attachments.edit', [1]));
$this->assertResponseStatus(200); $response->assertStatus(200);
// has bread crumb // has bread crumb
$this->see('<ol class="breadcrumb">'); $response->assertSee('<ol class="breadcrumb">');
$this->see($data['title']); $response->assertSee($data['title']);
} }