Elgg\Http\ResponseFactoryTest::testCanSendAjaxResponseFromOutput PHP Метод

testCanSendAjaxResponseFromOutput() публичный Метод

    public function testCanSendAjaxResponseFromOutput()
    {
        $service = $this->createService();
        ob_start();
        $data = ['foo' => 'bar'];
        $content = json_encode($data);
        $wrapped_content = json_encode(['value' => $data]);
        $response = $service->send($this->ajax->respondFromOutput($content));
        $this->assertInstanceOf(JsonResponse::class, $response);
        $this->assertEquals($wrapped_content, $response->getContent());
        $output = ob_get_clean();
        $this->assertEquals($wrapped_content, $output);
    }