List Info

Thread: SimpleDumper::dump




SimpleDumper::dump
country flaguser name
United Kingdom
2008-04-16 20:10:52
Hi

I noticed SimpleDumper::dump has been made static:

    static function dump($variable) {
        ...
        ...
    }

This results in a fatal error when SimpleDumper is mocked:

"Fatal error: Using $this when not in object context
in
/var/www/localhost/htdocs/simpletest-svn/simpletest/mock_obj
ects.php(1305) :
eval()'d code on line 230

The offending (generated) code:

class MockSimpleDumper extends SimpleDumper {
    ...
    ...

    static function dump($variable) {
        $args = func_get_args();
        $result =
&$this->_mock->_invoke("dump", $args);
        return $result;
    }

I can probably find a way to redo the test in question
without mocking
SimpleDumper but first I wanted to check if this is a
permanent change?


Noel

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
United States
2008-04-16 20:26:50
Noel Darlow wrote:
> This results in a fatal error when SimpleDumper is
mocked: [snip]

If the behavior is as you describe it, this is most
certainly a bug with
SimpleTest's mocking facilities. It's rather difficult to
mock static
interfaces without LSB (late static binding), which is only
going to be
around PHP 5.3, so this code shouldn't be generated at all.

-- 
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org&g
t; Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
United Kingdom
2008-04-16 21:21:02
On Wed, 16 Apr 2008 21:26:50 -0400
"Edward Z. Yang" <edwardzyangthewritingpot.com> wrote:

> If the behavior is as you describe it, this is most
certainly a bug
> with SimpleTest's mocking facilities. It's rather
difficult to mock
> static interfaces without LSB (late static binding),
which is only
> going to be around PHP 5.3, so this code shouldn't be
generated at
> all.

Maybe a user-friendly error ought to be generated if someone
does try
to mock a class with one or more static methods.

FYI, the test:

    function testCanDumpFile() {
        $this->test_case->createFile('foo', 'hello
world');
        $dumper = new MockSimpleDumper;
       
$this->reporter->setReturnReference('getDumper',
$dumper);
        $dumper->expectOnce('dump', array('hello
world'));
        $this->test_case->dumpFile('foo');
    }

The code:

class FileSystemTestCase extends UnitTestCase {
    ...
    ...

    function dumpFile($path) {
        $path = $this->_sandboxMask($path);
        $this->dump(file_get_contents($path));
    }



Noel

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
United States
2008-04-16 22:19:00
Noel Darlow wrote:
> FYI, the test: [snip]

If dump() is a static function, it should be called like
self::dump()
(don't know which class it is offhand)

-- 
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org&g
t; Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
user name
2008-04-17 03:38:56
Hi...

Noel Darlow wrote:
> I can probably find a way to redo the test in question
without mocking
> SimpleDumper but first I wanted to check if this is a
permanent change?

No. It was actually a mistake on my part.

Can you add this and your other issues to the SF ticket
system? I'm 
pretty busy this week and I'm worried I'm going to miss
something.

> 
> 
> Noel

yours, Marcus
-- 
Marcus Baker
marcuslastcraft.com

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
United Kingdom
2008-04-17 07:50:04
On Thu, 17 Apr 2008 09:38:56 +0100
Marcus Baker <marcuswordtracker.com> wrote:

> Can you add this and your other issues to the SF ticket
system? I'm 
> pretty busy this week and I'm worried I'm going to miss
something.

Rgr. Thanks.

Noel

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
France
2008-04-18 13:25:43
Hi Noel,

Noel Darlow wrote:
> On Thu, 17 Apr 2008 09:38:56 +0100
> Marcus Baker <marcuswordtracker.com> wrote:
> 
>> Can you add this and your other issues to the SF
ticket system? I'm 
>> pretty busy this week and I'm worried I'm going to
miss something.
> 
> Rgr. Thanks.

The "protected SimpleDumper::dump" and
"$_should_skip accessor" issues 
have been committed to SVN. I'll have a look at the
remaining one over 
the week-end (unless someone else makes the commit).

Yours,
	Perrick



------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: SimpleDumper::dump
country flaguser name
United Kingdom
2008-04-18 16:42:06
On Fri, 18 Apr 2008 20:25:43 +0200
Perrick Penet <perricknoparking.net> wrote:

> The "protected SimpleDumper::dump" and
"$_should_skip accessor"
> issues have been committed to SVN. I'll have a look at
the remaining
> one over the week-end (unless someone else makes the
commit).
> 
> Yours,
> 	Perrick

many thanks 

Noel

------------------------------------------------------------
-------------
This SF.net email is sponsored by the 2008 JavaOne(SM)
Conference 
Don't miss this year's exciting event. There's still time to
save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;1987
57673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )