I'm writing a Simpletest test case for a helper class that uses Js
helper, which has the value method for turning arbitrary PHP objects
into JSON. I've done the setup: import the Js helper and construct it
before using it. This is the error I'm getting:

Fatal error: Call to a member function value() on a non-object in /var/
www/atsui/meep/cake/libs/view/helpers/js.php on line 182

Here's the source code for my test case:

App::import('Helper', 'Js');
App::import('Helper', 'Googlemap');

class GooglemapHelperTestCase extends CakeTestCase {
    function startTest() {
        $this->Googlemap = new GooglemapHelper();
        $this->Js = new JsHelper();
    }

    function testJs() {
        $testArray = array(
            'border' => '1px solid black',
            'padding' => '5px',
            'float' => 'left',
            'clear' => 'both',
        );
        debug($this->Js->value($testArray));
    }

    function endTest() {
        unset($this->Googlemap);
        unset($this->Js);
        ClassRegistry::flush();
    }
}

The intention is to test my helper (Googlemap above), which uses the
Js helper, and the same error will appear if I just test a method in
my helper that uses $this->Js->value. I wonder what I'm missing in
this setup?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to