Reputation: 11978
I am using the book: "Agile Web Application Development with Yii 1.1 and PHP5" to get started with Yii.
While setting up my TDD environment and running my first test, the following warnings pop up:
sl@cker:/var/www/demo/protected/tests$ phpunit functional/SiteTest.php
PHPUnit 3.6.12 by Sebastian Bergmann.
Configuration read from /var/www/demo/protected/tests/phpunit.xml
PHP Warning: include(SiteTest: Firefox.php): failed to open stream: No such file or directory in /var/www/framework/YiiBase.php on line 423
PHP Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.:/var/www/demo/protected/components:/var/www/demo/protected/models:/usr/share/php:/
usr/share/pear') in /var/www/framework/YiiBase.php on line 423
...PHP Warning: include(SiteTest: Firefox.php): failed to open stream: No such file or directory in /var/www/framework/YiiBase.php on line 423
PHP Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.:/var/www/demo/protected/components:/var/www/demo/protected/models:/usr/share/php:/
usr/share/pear') in /var/www/framework/YiiBase.php on line 423
Time: 44 seconds, Memory: 8.25Mb
OK (3 tests, 10 assertions)
Does anyone know how I can fix this, or can I just ignore those warnings? The book doesn't say anything about a file named: Firefox.php
. The tests did run in Firefox though.
Extra info:
(all are the latest stable versions)
Upvotes: 4
Views: 3049
Reputation: 21
and what if my output is:
/usr/local/bin/phpunit: line 1: html: No such file or directory
/usr/local/bin/phpunit: line 2: syntax error near unexpected token
<''usr/local/bin/phpunit: line 2:
404 Not Found
I have my files structure as you mentioned
Upvotes: -1
Reputation: 11978
Ok.. I've solved it. I just answer my own question in case someone else bumps into this problem.
The solution is as follows.
Change phpunit.xml
into:
<phpunit bootstrap="bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<selenium>
<!-- <browser name="Firefox" browser="*firefox" /> -->
</selenium>
</phpunit>
And change WebTestCase.php
into:
<?php
/**
* Change the following URL based on your server configuration
* Make sure the URL ends with a slash so that we can use relative URLs in test cases
*/
define('TEST_BASE_URL','http://localhost/demo/index-test.php/');
/**
* The base class for functional test cases.
* In this class, we set the base URL for the test application.
* We also provide some common methods to be used by concrete test classes.
*/
class WebTestCase extends CWebTestCase
{
/**
* Sets up before each test method runs.
* This mainly sets the base URL for the test application.
*/
protected function setUp()
{
parent::setUp();
$this->setBrowser('*firefox');
$this->setBrowserUrl(TEST_BASE_URL);
}
}
Your output will be:
sl@cker:/var/www/demo/protected/tests$ phpunit functional/SiteTest.php
PHPUnit 3.6.12 by Sebastian Bergmann.
Configuration read from /var/www/demo/protected/tests/phpunit.xml
...
Time: 32 seconds, Memory: 8.25Mb
OK (3 tests, 10 assertions)
Upvotes: 7