Skip to content
Browse files

Add phpunit config and boostrap, unit test the autoloader

  • Loading branch information...
1 parent a0ce739 commit f9302aed9ed34f07200e9046248f285893b33c79 @ornicar committed Feb 12, 2011
Showing with 41 additions and 0 deletions.
  1. +25 −0 phpunit.xml
  2. +12 −0 test/Github/Tests/AutoloaderTest.php
  3. +4 −0 test/bootstrap.php
View
25 phpunit.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="test/bootstrap.php"
+>
+ <testsuites>
+ <testsuite name="php-github-api Test Suite">
+ <directory>./test/Github/</directory>
+ </testsuite>
+ </testsuites>
+
+ <filter>
+ <whitelist>
+ <directory suffix=".php">./lib/Github/</directory>
+ </whitelist>
+ </filter>
+</phpunit>
View
12 test/Github/Tests/AutoloaderTest.php
@@ -0,0 +1,12 @@
+<?php
+
+class Github_Tests_AutoloaderTest extends PHPUnit_Framework_TestCase
+{
+ public function testAutoload()
+ {
+ $this->assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Github');
+
+ $autoloader = new Github_Autoloader();
+ $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class');
+ }
+}
View
4 test/bootstrap.php
@@ -0,0 +1,4 @@
+<?php
+
+require_once dirname(__FILE__).'/../lib/Github/Autoloader.php';
+Github_Autoloader::register();

0 comments on commit f9302ae

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