You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /workspaces/phpunit-tutorial/www/tests/TestCaseClass.php on line 4
<?php
use PHPUnit\Framework\TestCase;
namespace TestNamespace;
class TestCaseClass extends TestCase
{
/**
* @dataProvider provider
*/
public function testMethod($data)
{
$this->assertTrue($data);
}
public function provider()
{
return [
'my named data' => [true],
'my data' => [true]
];
}
}
# phpunit tests/TestCaseClass.php
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /workspaces/phpunit-tutorial/www/tests/TestCaseClass.php on line 4
How to solve
In tests/DataTest.php apply this fix
- use PHPUnit\Framework\TestCase;
namespace TestNamespace;
+ use PHPUnit\Framework\TestCase;
+
The text was updated successfully, but these errors were encountered:
ricfio
added a commit
to ricfio/phpunit-documentation-english
that referenced
this issue
Mar 28, 2021
Uh oh!
There was an error while loading. Please reload this page.
Problem
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /workspaces/phpunit-tutorial/www/tests/TestCaseClass.php on line 4
Fix
ricfio#3
How to reproduce
Example 3.1 Named data sets
How to solve
In tests/DataTest.php apply this fix
The text was updated successfully, but these errors were encountered: