@@ 73-79 (lines=7) @@ | ||
70 | $this->assertEquals($this->uuid, $service->run(), 'called once!'); |
|
71 | } |
|
72 | ||
73 | public function testCreateAuthorServiceShouldReturnNullOnFailure() |
|
74 | { |
|
75 | $this->logger->expects($this->once())->method('error'); |
|
76 | $this->authorRepository->expects($this->once())->method('save')->will($this->throwException(new Exception())); |
|
77 | $service = new CreateAuthor($this->authorRepository, $this->author, $this->logger); |
|
78 | $this->assertEquals(null, $service->run(), 'Test exception'); |
|
79 | } |
|
80 | ||
81 | public function testEditAuthorService() |
|
82 | { |
|
@@ 88-94 (lines=7) @@ | ||
85 | $this->assertEquals($this->uuid, $service->run(), 'called once!'); |
|
86 | } |
|
87 | ||
88 | public function testEditAuthorServiceShouldReturnNullOnFailure() |
|
89 | { |
|
90 | $this->logger->expects($this->once())->method('error'); |
|
91 | $this->authorRepository->expects($this->once())->method('save')->will($this->throwException(new Exception())); |
|
92 | $service = new EditAuthor($this->authorRepository, $this->author, $this->logger); |
|
93 | $this->assertEquals(null, $service->run(), 'Test exception'); |
|
94 | } |
|
95 | ||
96 | public function testDeleteAuthorService() |
|
97 | { |
|
@@ 110-116 (lines=7) @@ | ||
107 | $this->assertEquals(false, $service->run(), 'Success'); |
|
108 | } |
|
109 | ||
110 | public function testDeleteAuthorServiceShouldReturnFalseOnFailure() |
|
111 | { |
|
112 | $this->logger->expects($this->once())->method('error'); |
|
113 | $this->authorRepository->expects($this->once())->method('delete')->will($this->throwException(new Exception())); |
|
114 | $service = new DeleteAuthor($this->authorRepository, $this->author, $this->logger); |
|
115 | $this->assertEquals(false, $service->run(), 'Test exception'); |
|
116 | } |
|
117 | ||
118 | public function testGetAuthorService() |
|
119 | { |
|
@@ 125-131 (lines=7) @@ | ||
122 | $this->assertEquals($this->author, $service->run(), 'Success'); |
|
123 | } |
|
124 | ||
125 | public function testGetAuthorServiceReturningException() |
|
126 | { |
|
127 | $this->logger->expects($this->once())->method('error'); |
|
128 | $this->authorRepository->expects($this->once())->method('get')->will($this->throwException(new Exception())); |
|
129 | $service = new GetAuthor($this->authorRepository, $this->uuid, $this->logger); |
|
130 | $this->assertEquals(false, $service->run(), 'Exception'); |
|
131 | } |
|
132 | ||
133 | public function testGetAuthorServiceReturningFalse() |
|
134 | { |
|
@@ 147-153 (lines=7) @@ | ||
144 | $this->assertEquals([$this->author], $service->run(), 'Success'); |
|
145 | } |
|
146 | ||
147 | public function testGetAuthorsListServiceException() |
|
148 | { |
|
149 | $this->logger->expects($this->once())->method('error'); |
|
150 | $this->authorRepository->expects($this->once())->method('getList')->with($this->filters)->will($this->throwException(new Exception())); |
|
151 | $service = new ListAuthors($this->authorRepository, $this->filters, $this->logger); |
|
152 | $this->assertEquals([], $service->run(), 'Exception'); |
|
153 | } |
|
154 | } |
|
155 |