|
From: Nicolas T. <nic...@gm...> - 2009-12-14 17:17:51
|
Hi,
I've got a fatal error while building a test.
************* The failing test case
<?php
class A {
function world($b, $val) {
}
}
Mock::generate('A');
class B {
function hello($val) {
$this->getA()->world($this, $val);
}
function getA() {
return new A();
}
}
Mock::generatePartial('B', 'B_TestVersion', array('getA'));
class ATest extends UnitTestCase {
function test() {
$a = new MockA();
$b = new B_TestVersion();
$b->setReturnReference('getA', $a);
$a->expect('world', array($b, 66));
$b->hello(66);
}
}
?>
*********** The call stack
[...]
7 0.0913 4406284 SimpleTestCase->run( object(CodendiHtmlReporter)[37]
) ../test_case.php:595
8 0.0920 4407688 SimpleExceptionTrappingInvoker->invoke( string(4)
) ../test_case.php:143
9 0.0921 4407824 SimpleInvokerDecorator->invoke( string(4)
) ../exceptions.php:43
10 0.0921 4407824 SimpleErrorTrappingInvoker->invoke( string(4)
) ../invoker.php:126
11 0.0921 4408352 SimpleInvokerDecorator->invoke( string(4) ) ../errors.php:49
12 0.0921 4408352 SimpleInvoker->invoke( string(4) ) ../invoker.php:126
13 0.0921 4408404 ATest->test( ) ../invoker.php:68
14 0.0929 4421520 B->hello( object(MockA)[45], long ) ../ATest.php:28
15 0.0930 4421952 MockA->world( object(B_TestVersion)[49],
object(MockA)[45] ) ../ATest.php:11
16 0.0930 4421952 SimpleMock->_invoke( string(5), array(2)
) ../mock_objects.php(1255) : eval()'d code:157
17 0.0930 4421952 SimpleMock->_checkExpectations( string(5), array(2),
long ) ../mock_objects.php:1061
18 0.0931 4421952 SimpleTestCase->assert(
object(ParametersExpectation)[57], array(2), string(25)
) ../mock_objects.php:1105
19 0.0931 4421952 ParametersExpectation->test( array(2) ) ../test_case.php:309
20 0.0931 4421952 ParametersExpectation->_testParameter(
object(B_TestVersion)[49], object(B_TestVersion)[49]
) ../mock_objects.php:65
21 0.0932 4422620 IdenticalExpectation->test(
object(B_TestVersion)[49] ) ../mock_objects.php:82
22 0.0932 4422620 SimpleTestCompatibility->isIdentical(
object(B_TestVersion)[49], object(B_TestVersion)[49]
) ../expectation.php:520
23 0.0932 4422620 SimpleTestCompatibility->_isIdenticalType(
object(B_TestVersion)[49], object(B_TestVersion)[49]
) ../compatibility.php:42
24 0.0933 4422620 SimpleTestCompatibility->_isArrayOfIdenticalTypes(
array(2), array(2) ) ../compatibility.php:68
25 0.0933 4422680 SimpleTestCompatibility->_isIdenticalType(
object(SimpleMock)[50], object(SimpleMock)[50]
) ../compatibility.php:94
26 0.0933 4423388 SimpleTestCompatibility->_isArrayOfIdenticalTypes(
array(9), array(9) ) ../compatibility.php:68
27 0.0934 4423520 SimpleTestCompatibility->_isIdenticalType(
object(SimpleCallSchedule)[51], object(SimpleCallSchedule)[51]
) ../compatibility.php:94
28 0.0934 4423640 SimpleTestCompatibility->_isArrayOfIdenticalTypes(
array(3), array(3) ) ../compatibility.php:68
29 0.0934 4423752 SimpleTestCompatibility->_isIdenticalType( array(1),
array(1) ) ../compatibility.php:94
30 0.0935 4423752 SimpleTestCompatibility->_isArrayOfIdenticalTypes(
array(1), array(1) ) ../compatibility.php:71
[...] and so on, and so on...
*********** Variables in local scope
$context Undefined
$filename =
string '/tests/include/simpletest/compatibility.php' (length=109)
$label Undefined
$line =
int 92
$mask =
null
$message =
string 'Non-static method SimpleTestCompatibility::_isIdenticalType()
should not be called statically, assuming $this from incompatible
context' (length=135)
$queue Undefined
$severity =
int 2048
***************************
My workaround for this is to put a wildcard in the expectation:
$a->expect('world', array('*', 66));
However I don't like it so much.
My ST version is 1.0.1
Has this bug been already covered in the upcoming 1.1 ?
Thanks,
Nicolas
|