Yii Framework Forum: Phpunit Error: No Such File Seleniumtestcase.php - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Phpunit Error: No Such File Seleniumtestcase.php Rate Topic: -----

#1 User is offline   juszrnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 17-June 14

Posted 17 June 2014 - 10:10 AM

Hi. I'm learning how to use Yii, and i am trying to make a simple test with PHPUnit, but i get the following error:
PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/yii/framework/test/CWebTestCase.php on line 12



My class only contains:
<?php

class DbTest extends CTestCase {

	public function testConnection() {
		$this->assertTrue(true);	
	}

}

0

#2 User is offline   juszrnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 17-June 14

Posted 18 June 2014 - 06:06 AM

Anyone?
0

#3 User is offline   Wilbert van Diemen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 22-July 14

Posted 22 July 2014 - 12:43 PM

Hi juszrnt,

I was a bit irritated by this so instead of skipping the test, I looked around for a shortcut solution on this. Luckily for the presented test in the book Web Application Development with Yii and PHP on page 53 you don't need the class CWebTestCase extended in WebTestCase.php which in turn loads 'PHPUnit/Extensions/SeleniumTestCase.php').

You can change WebTestCase.php in

/**
 * 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','h t t p : / / localhost/testdrive/index-test.php/'); << commented out

/**
 * 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 TestCase extends CTestCase << changed
{
	/**
	 * Sets up before each test method runs.
	 * This mainly sets the base URL for the test application.
	 */
	protected function setUp()
	{
		parent::setUp();
		//$this->setBrowserUrl(TEST_BASE_URL); << commented out
	}
}


Save it as TestCase.php

Change in bootstrap.php in the tests map the line

require_once(dirname(__FILE__).'/WebTestCase.php');


in

require_once(dirname(__FILE__).'/TestCase.php');


BTW: I hope that the YII people will adept the new way of using PHPUnit as suggested by Sebastian Bergmann. Not via PEAR but as a PHPUnit.phar (php archive).

Bye, Wilbert
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users