This is an example of autoloading classes and including unit tests.

This commit is contained in:
Beanow 2014-10-11 00:13:59 +02:00
commit dd6987ff02
7 changed files with 90 additions and 2 deletions

12
tests/phpunit.xml Normal file
View file

@ -0,0 +1,12 @@
<phpunit bootstrap="../autoload.php">
<testsuites>
<testsuite>
<directory>unit/src</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory>../src</directory>
</whitelist>
</filter>
</phpunit>

View file

@ -0,0 +1,23 @@
<?php namespace Friendica\Directory\Example;
class HelloTest extends \PHPUnit_Framework_TestCase
{
/**
* Test the sayHello() method.
*/
public function testSayHello()
{
//Create a new Hello class instance.
$instance = new Hello();
//Call the method sayHello() that we want to test.
$output = $instance->sayHello();
//Check that it returns the message we expect.
$this->assertEquals("Hello world!", $output);
}
}