Skip to content
Browse files

add test for factory driver loading error

  • Loading branch information...
1 parent 32fb679 commit 9f401904b94584bfa7d16552c089463e511236f9 @cweiske committed
Showing with 40 additions and 0 deletions.
  1. +21 −0 tests/Text/CAPTCHATest.php
  2. +7 −0 tests/bootstrap.php
  3. +12 −0 tests/phpunit.xml
View
21 tests/Text/CAPTCHATest.php
@@ -0,0 +1,21 @@
+<?php
+require_once 'Text/CAPTCHA.php';
+
+class Text_CAPTCHATest extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ error_reporting(error_reporting() & ~E_STRICT);
+ }
+
+ public function testFactoryDriverError()
+ {
+ //ignore include_once error
+ error_reporting(error_reporting() & ~E_WARNING);
+
+ $res = Text_CAPTCHA::factory('doesnotexist');
+ $this->assertInstanceOf('PEAR_Error', $res);
+ }
+}
+
+?>
View
7 tests/bootstrap.php
@@ -0,0 +1,7 @@
+<?php
+if (is_dir(__DIR__ . '/../Text/CAPTCHA')) {
+ set_include_path(
+ __DIR__ . '/../' . PATH_SEPARATOR . get_include_path()
+ );
+}
+?>
View
12 tests/phpunit.xml
@@ -0,0 +1,12 @@
+<phpunit
+ colors="true"
+ bootstrap="bootstrap.php"
+ verbose="true"
+ strict="true"
+>
+ <filter>
+ <whitelist>
+ <directory suffix=".php">../Text/</directory>
+ </whitelist>
+ </filter>
+</phpunit>

0 comments on commit 9f40190

Please sign in to comment.
Something went wrong with that request. Please try again.