Remove unneeded cardId parameters
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -155,6 +155,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
$attachment = new Attachment();
|
||||
$attachment->setType($type);
|
||||
$attachment->setData($data);
|
||||
$attachment->setCardId(123);
|
||||
return $attachment;
|
||||
}
|
||||
|
||||
@@ -255,7 +256,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
->method('display')
|
||||
->with($attachment)
|
||||
->willReturn($response);
|
||||
$actual = $this->attachmentService->display(123, 1);
|
||||
$actual = $this->attachmentService->display(1);
|
||||
$this->assertEquals($response, $actual);
|
||||
}
|
||||
|
||||
@@ -272,7 +273,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
->method('display')
|
||||
->with($attachment)
|
||||
->will($this->throwException(new InvalidAttachmentType('deck_file')));
|
||||
$this->attachmentService->display(123, 1);
|
||||
$this->attachmentService->display(1);
|
||||
}
|
||||
public function testUpdate() {
|
||||
$attachment = $this->createAttachment('deck_file', 'file_name.jpg');
|
||||
@@ -294,7 +295,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
$a->setExtendedData(['mime' => 'image/jpeg']);
|
||||
});
|
||||
|
||||
$actual = $this->attachmentService->update(123, 1, 'file_name.jpg');
|
||||
$actual = $this->attachmentService->update(1, 'file_name.jpg');
|
||||
|
||||
$expected->setExtendedData(['mime' => 'image/jpeg']);
|
||||
$expected->setLastModified($attachment->getLastModified());
|
||||
@@ -318,7 +319,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
$this->attachmentMapper->expects($this->once())
|
||||
->method('delete')
|
||||
->willReturn($attachment);
|
||||
$actual = $this->attachmentService->delete(123, 1);
|
||||
$actual = $this->attachmentService->delete(1);
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
@@ -343,7 +344,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
->method('update')
|
||||
->willReturn($attachment);
|
||||
$expected->setDeletedAt(23);
|
||||
$actual = $this->attachmentService->delete(123, 1);
|
||||
$actual = $this->attachmentService->delete(1);
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
@@ -363,7 +364,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
->method('update')
|
||||
->willReturn($attachment);
|
||||
$expected->setDeletedAt(0);
|
||||
$actual = $this->attachmentService->restore(123, 1);
|
||||
$actual = $this->attachmentService->restore(1);
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
@@ -380,6 +381,6 @@ class AttachmentServiceTest extends TestCase {
|
||||
$this->attachmentServiceImpl->expects($this->once())
|
||||
->method('allowUndo')
|
||||
->willReturn(false);
|
||||
$actual = $this->attachmentService->restore(123, 1);
|
||||
$actual = $this->attachmentService->restore(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,14 +73,9 @@ class AttachmentApiControllerTest extends \Test\TestCase {
|
||||
->method('display')
|
||||
->willReturn($this->attachmentExample);
|
||||
|
||||
$this->request->expects($this->exactly(2))
|
||||
$this->request->expects($this->once())
|
||||
->method('getParam')
|
||||
->withConsecutive(
|
||||
['cardId'],
|
||||
['attachmentId']
|
||||
)->willReturnonConsecutiveCalls(
|
||||
$this->cardId,
|
||||
$this->attachmentExample->getId());
|
||||
->willReturn($this->attachmentExample->getId());
|
||||
|
||||
$expected = $this->attachmentExample;
|
||||
$actual = $this->controller->display();
|
||||
@@ -114,14 +109,9 @@ class AttachmentApiControllerTest extends \Test\TestCase {
|
||||
->method('update')
|
||||
->willReturn($this->attachmentExample);
|
||||
|
||||
$this->request->expects($this->exactly(2))
|
||||
$this->request->expects($this->once())
|
||||
->method('getParam')
|
||||
->withConsecutive(
|
||||
['cardId'],
|
||||
['attachmentId']
|
||||
)->willReturnonConsecutiveCalls(
|
||||
$this->cardId,
|
||||
$this->attachmentExample->getId());
|
||||
->willReturn($this->attachmentExample->getId());
|
||||
|
||||
$expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
|
||||
$actual = $this->controller->update($data);
|
||||
@@ -133,14 +123,9 @@ class AttachmentApiControllerTest extends \Test\TestCase {
|
||||
->method('delete')
|
||||
->willReturn($this->attachmentExample);
|
||||
|
||||
$this->request->expects($this->exactly(2))
|
||||
$this->request->expects($this->once())
|
||||
->method('getParam')
|
||||
->withConsecutive(
|
||||
['cardId'],
|
||||
['attachmentId']
|
||||
)->willReturnonConsecutiveCalls(
|
||||
$this->cardId,
|
||||
$this->attachmentExample->getId());
|
||||
->willReturn($this->attachmentExample->getId());
|
||||
|
||||
$expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
|
||||
$actual = $this->controller->delete();
|
||||
@@ -152,14 +137,9 @@ class AttachmentApiControllerTest extends \Test\TestCase {
|
||||
->method('restore')
|
||||
->willReturn($this->attachmentExample);
|
||||
|
||||
$this->request->expects($this->exactly(2))
|
||||
$this->request->expects($this->once())
|
||||
->method('getParam')
|
||||
->withConsecutive(
|
||||
['cardId'],
|
||||
['attachmentId']
|
||||
)->willReturnonConsecutiveCalls(
|
||||
$this->cardId,
|
||||
$this->attachmentExample->getId());
|
||||
->willReturn($this->attachmentExample->getId());
|
||||
|
||||
$expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
|
||||
$actual = $this->controller->restore();
|
||||
|
||||
@@ -44,8 +44,7 @@ class AttachmentControllerTest extends \Test\TestCase {
|
||||
$this->controller = new AttachmentController(
|
||||
'deck',
|
||||
$this->request,
|
||||
$this->attachmentService,
|
||||
$this->userId
|
||||
$this->attachmentService
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,8 +54,8 @@ class AttachmentControllerTest extends \Test\TestCase {
|
||||
}
|
||||
|
||||
public function testDisplay() {
|
||||
$this->attachmentService->expects($this->once())->method('display')->with(1, 2);
|
||||
$this->controller->display(1, 2);
|
||||
$this->attachmentService->expects($this->once())->method('display')->with(2);
|
||||
$this->controller->display(2);
|
||||
}
|
||||
|
||||
public function testCreate() {
|
||||
@@ -76,25 +75,25 @@ class AttachmentControllerTest extends \Test\TestCase {
|
||||
->will($this->onConsecutiveCalls('data'));
|
||||
$this->attachmentService->expects($this->once())
|
||||
->method('update')
|
||||
->with(1, 2, 'data')
|
||||
->with(2, 'data')
|
||||
->willReturn(1);
|
||||
$this->assertEquals(1, $this->controller->update(1, 2));
|
||||
$this->assertEquals(1, $this->controller->update(2));
|
||||
}
|
||||
|
||||
|
||||
public function testDelete() {
|
||||
$this->attachmentService->expects($this->once())
|
||||
->method('delete')
|
||||
->with(123, 234)
|
||||
->with(234)
|
||||
->willReturn(1);
|
||||
$this->assertEquals(1, $this->controller->delete(123, 234));
|
||||
$this->assertEquals(1, $this->controller->delete(234));
|
||||
}
|
||||
|
||||
public function testRestore() {
|
||||
$this->attachmentService->expects($this->once())
|
||||
->method('restore')
|
||||
->with(123, 234)
|
||||
->with(234)
|
||||
->willReturn(1);
|
||||
$this->assertEquals(1, $this->controller->restore(123, 234));
|
||||
$this->assertEquals(1, $this->controller->restore(234));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user