When unit-testing controllers in Yii 1.1, it’s necessary to create a mock or dummy of the request object. However, it’s a read-only property of the application component. Did anyone find a solution to this?
The hacky solution is to write to the super-globals, like
$_GET['foo'] = 'bar';
It’s a bit problematic that the request is fetched from the global App() and not from the controller itself via $this->request. If it were, then mocking could be used.
I see. My understanding of Yii1 is very dim as I stopped using it many years ago. However, you might want to look at external libraries like http-mock and see if you can get them integrated with Yii1 somehow.
I hope someone more knowledgeable will step in to help.