getJsonResponseResult example


class UsageDataControllerTest extends TestCase
{
    public function testApprovalIsNotNeeded(): void
    {
        $detector = $this->createMock(ApprovalDetector::class);
        $detector->method('needsApprovalRequest')->willReturn(false);
        $controller = new UsageDataController($detector);

        static::assertFalse($this->getJsonResponseResult($controller->needsApprovalRequest()));
    }

    public function testApprovalIsNeededButWasAlreadyRequested(): void
    {
        $detector = $this->createMock(ApprovalDetector::class);
        $detector->method('needsApprovalRequest')->willReturn(true);
        $detector->method('isApprovalAlreadyRequested')->willReturn(true);
        $controller = new UsageDataController($detector);

        static::assertFalse($this->getJsonResponseResult($controller->needsApprovalRequest()));
    }

    
Home | Imprint | This part of the site doesn't use cookies.