3
votes

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:

  • PHP Version 5.3.10
  • Platform: Ubuntu 12.04
  • Server: Apache/2.2.22
  • PHPUnit version: 3.6.12
  • Selenium version: 2.25.0
  • Yii version: v1.1.12

(all are the latest stable versions)

2

2 Answers

6
votes

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)
-1
votes

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