Что не так со следующим тестом:
<?php
class TestSomething extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider provider
*/
public function testSomething($array, $expectedResult)
{
$this->assertEquals($array, $expectedResult);
}
public function provider()
{
return array(
array(array(), array()),
);
}
}
?>
Сообщение об ошибке:
$phpunit index.php
PHP Warning: Missing argument 1 for TestSomething::testSomething() in /var/www/tests/something-test/index.php on line 8
PHP Warning: Missing argument 2 for TestSomething::testSomething() in /var/www/tests/something-test/index.php on line 8
PHP Notice: Undefined variable: array in /var/www/tests/something-test/index.php on line 11
PHP Notice: Undefined variable: expectedResult in /var/www/tests/something-test/index.php on line 11
PHP Fatal error: Uncaught exception 'PHPUnit_Framework_ExpectationFailedException' with message 'Failed asserting that
Array
(
[0] => Array
(
)
[1] => Array
(
)
)
is equal to <string:testSomething>.' in /usr/share/php/PHPUnit/Framework/Constraint/IsEqual.php:164
Stack trace:
#0 /usr/share/php/PHPUnit/Framework/Assert.php(2087): PHPUnit_Framework_Constraint_IsEqual->fail(Array, '')
#1 /usr/share/php/PHPUnit/Framework/Assert.php(343): PHPUnit_Framework_Assert::assertThat(Array, Object(PHPUnit_Framework_Constraint_IsEqual), '')
#2 /var/www/tests/something-test/index.php(11): PHPUnit_Framework_Assert::assertEquals('testSomething', Array)
#3 /usr/share/php/PHPUnit/Framework/TestSuite.php(537): TestSomething->testSomething('testSomething', Array, 0)
#4 /usr/share/php/PHPUnit/Framework/TestSuite.php(816): PHPUnit_Framework_TestSuite::createTest(Object(ReflectionClass), 'testSomething')
#5 /usr/share/php/PHPUnit/Framework/TestSuite.php(224): PHPUnit_Framework_TestSuite->addTestMethod(Object(ReflectionClass), Object(Reflectio in /usr/share/php/PHPUnit/Framework/Constraint/IsEqual.php on line 164
Спасибо.