Level 4
Got the info from @tk. All you have to do is add a protected property in the parent class TestCase
protected $baseUrl = 'http://yoursite.dev';
It solved the issue
2 likes
I have the default setup. My composer.json has this:
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
When i run phpunit, i get the following error: I'm not sure why?
PHPUnit 4.8.6 by Sebastian Bergmann and contributors.
E
Time: 272 ms, Memory: 13.25Mb
There was 1 error:
1) ExampleTest::testBasicExample
ErrorException: Undefined property: ExampleTest::$baseUrl
My ExampleTest.php contains the following code
<?php
class ExampleTest extends TestCase {
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$response = $this->call('GET', '/');
$this->assertEquals(200, $response->getStatusCode());
}
}
I'm very new to testing. Thank you for helping.
Got the info from @tk. All you have to do is add a protected property in the parent class TestCase
protected $baseUrl = 'http://yoursite.dev';
It solved the issue
Please or to participate in this conversation.