Working state but no uploads
This commit is contained in:
@@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase;
|
||||
* Couvre la création, la mise à jour, la suppression et les lectures.
|
||||
* HtmlSanitizerInterface et PostRepository sont mockés pour isoler la logique métier.
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
|
||||
final class PostServiceTest extends TestCase
|
||||
{
|
||||
/** @var PostRepositoryInterface&MockObject */
|
||||
@@ -65,7 +66,7 @@ final class PostServiceTest extends TestCase
|
||||
public function testGetPostsByUserIdDelegatesToRepository(): void
|
||||
{
|
||||
$posts = [$this->makePost(1, 'Titre', 'slug-titre')];
|
||||
$this->repository->method('findByUserId')->with(3, null)->willReturn($posts);
|
||||
$this->repository->expects($this->once())->method('findByUserId')->with(3, null)->willReturn($posts);
|
||||
|
||||
$this->assertSame($posts, $this->service->getPostsByUserId(3));
|
||||
}
|
||||
@@ -181,7 +182,7 @@ final class PostServiceTest extends TestCase
|
||||
public function testSearchPostsDelegatesToRepository(): void
|
||||
{
|
||||
$posts = [$this->makePost(1, 'Résultat', 'resultat')];
|
||||
$this->repository->method('search')->with('mot', null, null)->willReturn($posts);
|
||||
$this->repository->expects($this->once())->method('search')->with('mot', null, null)->willReturn($posts);
|
||||
|
||||
$this->assertSame($posts, $this->service->searchPosts('mot'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user