Yii Framework Forum: Phpunit Error : No Available Commands - 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 Available Commands Rate Topic: -----

#1 User is offline   Emily Dickinson 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 17-September 10
  • Location:Albuquerque, NM

Posted 18 December 2012 - 10:20 PM

I used PEAR to install PHPUnit and had no problems. I'm on a Mac. I used PHPUnit for months without error. Now I haven't used it in a several months, and I ran the same command I ran months ago, but now I get an error. E.g.

$ /opt/local/bin/PHPUnit ActivityUtilTest
No available commands.
Please define them under the following directory:

// -----------------------------
// HERE's the file ActivityUtilTest.php :
// -----------------------------

require_once('bootstrap.php');

class ActivityUtilTest extends PHPUnit_Framework_TestCase {
    public function test01() {
             $this->assertEquals(1, 1);
   }
}

// -----------------------------
// HERE's the file bootstrap.php
// -----------------------------
$yii=dirname(__FILE__).'/../_shared/yii/framework/yii.php';
$config=dirname(__FILE__).'/../_config/CONFIG.php';
require_once($yii);
Yii::createConsoleApplication($config)->run();


I'm running the latest Yii code, version 1.1.12

Any help appreciated, thank you.
0

#2 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 18 December 2012 - 11:37 PM

"No available commands" is something that CHelpCommand would write to the console if invoked with no commands set in place. Can you check if the command runner is invoked somewhere in your test suite?

Not sure if it's related, but there were some issues with Yii and PHPUnit 3.7+. Have you updated PHPUnit recently?
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#3 User is offline   Emily Dickinson 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 17-September 10
  • Location:Albuquerque, NM

Posted 19 December 2012 - 12:59 PM

I am definitely using the most recent PHP Unit - version 3.7.10, and would really prefer NOT to downgrade PHPUnit.

By switching to an older version of Yii (1.1.10), the unit test will now run, but it does give an ugly warning first about no available commands. (And yes, I tried the *hack* of creating some empty commands in the directory protected/commands. That still causes the warning to be spewed.)

Here's the latest output, which I get again by reverting to Yii 1.1.10:

phpunit --configuration phpunit.xml ActivityUtilTest
No available commands.
Please define them under the following directory:
	
PHPUnit 3.7.10 by Sebastian Bergmann.

Configuration read from ~/Sites/bb/protected/tests/unit/phpunit.xml

.
ActivityUtilTest::testFetchAssignmentByPk 

Time: 0 seconds, Memory: 10.00Mb

OK (1 test, 1 assertion)

I would much prefer to be using the latest Yii. Ideas anyone?
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