Widget not passing variables to views

I can’t seem to get variables passed from a widget class to its view classes. I get the error:

Undefined variable: test

Here is the run function in the widget:




public function run()

	{

		$test='testdata';

		$this->render('application.extensions.widgets.Favorites.views._userview', array($this->dataProvider), array('test'=>$test));

	}



This is div in the view:




<div id="test">

    	<?php echo $test; ?>

</div>



What is the problem?

Thanks,

Alex

i think at this line:




 $this->render('application.extensions.widgets.Favorites.views._userview', array($this->dataProvider), array('test'=>$test));



should be:




 $this->render('application.extensions.widgets.Favorites.views._userview',  array('test'=>$test,'dataprovider'=>$this->dataProvider));



public string render(string $view, array $data=NULL, boolean $return=false)