Crud\Test\TestCase\Action\IndexActionTest::testGetWithViewVar PHP Method

testGetWithViewVar() public method

Test that changing the viewVar reflects in controller::$viewVar
public testGetWithViewVar ( ) : void
return void
    public function testGetWithViewVar()
    {
        $this->_eventManager->on('Dispatcher.invokeController', ['priority' => 1000], function ($event) {
            $this->_controller->Crud->action('index')->viewVar('items');
            $this->_subscribeToEvents($this->_controller);
        });
        $this->get('/blogs');
        $this->assertContains('Page 1 of 2, showing 3 records out of 5 total', $this->_response->body());
        $this->assertEvents(['beforePaginate', 'afterPaginate', 'beforeRender']);
        $this->assertNotNull($this->viewVariable('viewVar'));
        $this->assertNotNull($this->viewVariable('items'));
        $this->assertNotNull($this->viewVariable('success'));
    }