first test for service factory

This commit is contained in:
Christian Weiske 2011-04-12 08:47:44 +02:00
parent 36ff61b38e
commit 90f29d6e67
3 changed files with 23 additions and 5 deletions

View file

@ -107,6 +107,7 @@ class SemanticScuttle_Service_Factory
/** /**
* Loads self::$db if it is not loaded already. * Loads self::$db if it is not loaded already.
* Dies if the connection could not be established.
* *
* @return void * @return void
*/ */
@ -141,7 +142,7 @@ class SemanticScuttle_Service_Factory
/** /**
* Returns sql database object * Returns sql database object
* *
* @return void * @return sql_db Database instance
*/ */
public static function getDb() public static function getDb()
{ {

13
tests/FactoryTest.php Normal file
View file

@ -0,0 +1,13 @@
<?php
class FactoryTest extends TestBase
{
public function testGetDb()
{
$this->assertInstanceOf(
'sql_db',
SemanticScuttle_Service_Factory::getDb()
);
}
}
?>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<phpunit> <phpunit strict="true" colors="true"
bootstrap="prepare.php"
>
<filter> <filter>
<blacklist> <whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">.</directory> <directory suffix=".php">../src/SemanticScuttle/</directory>
</blacklist> <directory suffix=".php">../data/templates/</directory>
<directory suffix=".php">../www/</directory>
</whitelist>
</filter> </filter>
</phpunit> </phpunit>