Working state but no uploads

This commit is contained in:
julien
2026-03-16 02:33:18 +01:00
parent cc3fbdc830
commit 55d2da9f2f
52 changed files with 121 additions and 49 deletions

View File

@@ -16,6 +16,7 @@ use PHPUnit\Framework\TestCase;
* et la suppression (blocage si articles rattachés).
* Le repository est remplacé par un mock pour isoler le service.
*/
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class CategoryServiceTest extends TestCase
{
/** @var CategoryRepositoryInterface&MockObject */
@@ -129,7 +130,7 @@ final class CategoryServiceTest extends TestCase
{
$category = new Category(5, 'PHP', 'php');
$this->repository->method('hasPost')->with(5)->willReturn(false);
$this->repository->expects($this->once())->method('hasPost')->with(5)->willReturn(false);
$this->repository->expects($this->once())->method('delete')->with(5);
$this->service->delete($category);
@@ -142,7 +143,7 @@ final class CategoryServiceTest extends TestCase
{
$category = new Category(5, 'PHP', 'php');
$this->repository->method('hasPost')->with(5)->willReturn(true);
$this->repository->expects($this->once())->method('hasPost')->with(5)->willReturn(true);
$this->repository->expects($this->never())->method('delete');
$this->expectException(\InvalidArgumentException::class);
@@ -181,7 +182,7 @@ final class CategoryServiceTest extends TestCase
public function testFindBySlugReturnsCategoryWhenFound(): void
{
$cat = new Category(3, 'PHP', 'php');
$this->repository->method('findBySlug')->with('php')->willReturn($cat);
$this->repository->expects($this->once())->method('findBySlug')->with('php')->willReturn($cat);
$this->assertSame($cat, $this->service->findBySlug('php'));
}