Skip to content

Commit

Permalink
Don't require composer autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwamboldt committed Feb 10, 2015
1 parent 07cf724 commit f339258
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion phpunit.xml.dist
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Tests suite">
Expand Down
21 changes: 21 additions & 0 deletions tests/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public function __construct()
*/
class UtilityPHPTest extends PHPUnit_Framework_TestCase
{
protected $hasAutoloader = false;

/**
* Allows for the testing of private and protected methods.
*
Expand All @@ -39,6 +41,25 @@ protected static function getMethod($name)
return $method;
}

public function setup()
{
$dir = dirname(__FILE__) . '/..';

if (file_exists("{$dir}/vendor/autoload.php")) {
require_once "{$dir}/vendor/autoload.php";
$this->hasAutoloader = true;
} else {
require_once "{$dir}/util.php";
}
}

public function test_autoloader()
{
if (!$this->hasAutoloader) {
$this->markTestSkipped('Composer autoloader is not present, tests will be skipped');
}
}

public function test_array_get()
{
$_GET = array();
Expand Down

0 comments on commit f339258

Please sign in to comment.