ProductReviewCountService example


class ProductReviewCountServiceTest extends TestCase
{
    private ProductReviewCountService $productReviewCountService;

    private MockObject&Connection $connection;

    protected function setUp(): void
    {
        $this->connection = $this->createMock(Connection::class);
        $this->productReviewCountService = new ProductReviewCountService($this->connection);
    }

    public function testUpdateReviewCountWithInvalidReviewIds(): void
    {
        $this->connection->expects(static::once())->method('fetchFirstColumn')->willReturn([]);
        $this->connection->expects(static::never())->method('executeStatement');

        $this->productReviewCountService->updateReviewCount([]);
    }

    public function testUpdateReviewCount(): void
    {
Home | Imprint | This part of the site doesn't use cookies.