Bolt\Tests\Controller\Async\GeneralTest::testDashboardNewsWithVariable PHP Method

testDashboardNewsWithVariable() public method

    public function testDashboardNewsWithVariable()
    {
        $app = $this->getApp();
        $app['cache']->flushAll();
        $this->setRequest(Request::create('/async/dashboardnews'));
        $app['config']->set('general/branding/news_variable', 'testing');
        $testGuzzle = $this->getMockGuzzleClient();
        $requestInterface = $this->createMock(RequestInterface::class);
        $requestInterface->method('getBody')->will($this->returnValue('{"testing":[{"item":"one"},{"item":"two"},{"item":"three"}]}'));
        $testGuzzle->expects($this->any())->method('get')->will($this->returnValue($requestInterface));
        $app['guzzle.client'] = $testGuzzle;
        $response = $this->controller()->dashboardNews($this->getRequest());
        $context = $response->getContext();
        $this->assertEquals(['item' => 'one'], (array) $context['context']['information']);
    }