Crud\Test\TestCase\Action\ViewActionTest::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('view')->viewVar('item');
            $this->_subscribeToEvents($this->_controller);
        });
        $this->get('/blogs/view/1');
        $this->assertEvents(['beforeFind', 'afterFind', 'beforeRender']);
        $this->assertNotNull($this->viewVariable('viewVar'));
        $this->assertNotNull($this->viewVariable('item'));
        $this->assertNotNull($this->viewVariable('success'));
    }