Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to write some test cases for an action in a ZF1 application. The action requires that the user be logged in, which is determined by certain data being present in the Session_Namespace.

I wrote the following setUp() function to preset the namespace with the required variables. However, it appears that the variables are not being set. The var_dump result is shown below.

How do I set up PHPUnit so that I can prepopulate the appropriate namespace with the needed variables?

public function setUp() {
    $authNamespace = new Zend_Session_Namespace('auth');
    $authNamespace->user_role = 'ADMIN';
    $authNamespace->user_id = 1;
    var_dump($authNamespace);
}
.object(Zend_Session_Namespace)#411 (1) {
    ["_namespace":protected]=>string(4) "auth"
}
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.