This is an example of autoloading classes and including unit tests.
This commit is contained in:
parent
cf1f60e092
commit
dd6987ff02
7 changed files with 90 additions and 2 deletions
12
tests/phpunit.xml
Normal file
12
tests/phpunit.xml
Normal 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>
|
23
tests/unit/src/Example/HelloTest.php
Normal file
23
tests/unit/src/Example/HelloTest.php
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue