PHP Unit test creation.

I am trying to follow along the instructions for creating a unit test in PHPStorm http://www.jetbrains.com/phpstorm/webhelp/creating-phpunit-tests.html. But I get hung up on step 3. It indicates that a 'Generate PHPUnitTest dialog box will appear and I don't see the dialog box. How do I create a unit test? For example I have a test class that was genated by PHPStorm and it is in the test directory. I would like to generate a test for the method 'Version' in the test subject. How is this done?

I seem to have gotten past hte error reported in the previous paragraph (through trial and error). Now I get the message:

PHPUnit_Framework_AssertionFailedError : No tests found in class "WebApiExternalAccessClientTest".

I have a test class:

 
class WebApiExternalAccessClientTest extends PHPUnit_Framework_TestCase


I have setup and teardown methods for the class:

 
private static $client;
public static function setUpBeforeClass()
{
    $client = new WebApiExternalAccessClient();
}
public static function tearDownAfterClass()
{
    WebApiExternalAccessClientTest::$client->Close();
}

Then I have the tests.

 
public function GetSiteProperties()
{
    $home = WebApiExternalAccessClientTest::$client->QuerySiteProperties();
    $this->assertTrue(TRUE);
}
public function GetPresentations()
{
    $presentations = WebApiExternalAccessClientTest::$client->QueryAllPresentations();
    $this->assertTrue(TRUE);
}
 
. . . . . . .
 

Do I need to decorate the methods somehow? Why are there 'no tests'? I found that I coud prefix each test with the word 'test' and they were then found. Thank you.

Now I am getting the error:

Fatal error: Call to a member function QuerySiteProperties() on a non-object in C:\xampp\apps\moodle\htdocs\mod\mediasite\test\WebApiExternalAccessClientTest.php on line 43


Isn't the call
 

 
$home = WebApiExternalAccessClientTest::$client->QuerySiteProperties(); 
 

Correct?

Thank you.

Please sign in to leave a comment.