2015年11月27日 星期五

The reason why singleton is a “problem” with PHPUnit

So we add to our test:
1
2
3
4
5
6
7
8
class FooTest extends PHPUnit_Framework_TestCase
{
...
    public function tearDown()
    {
        Foo::tearDown();
    }
}
And now we implement the tearDown function in our Foo Class

1
2
3
4
public static function tearDown()
{
    static::$instance = NULL;
}

refer : http://gonzalo123.com/2012/09/24/the-reason-why-singleton-is-a-problem-with-phpunit/

沒有留言:

wibiya widget