replace __DIR__ with dirname(__FILE__)

This commit is contained in:
scribu
2012-03-17 23:05:52 -07:00
committed by Justin Hileman
parent bec9ce8448
commit 550da21455
8 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ class Mustache_Test_AutoloaderTest extends PHPUnit_Framework_TestCase {
}
public function testAutoloader() {
$loader = new Mustache_Autoloader(__DIR__.'/../../fixtures/autoloader');
$loader = new Mustache_Autoloader(dirname(__FILE__).'/../../fixtures/autoloader');
$this->assertNull($loader->autoload('NonMustacheClass'));
$this->assertFalse(class_exists('NonMustacheClass'));
@@ -46,7 +46,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
* @return array
*/
public function getExamples() {
$path = realpath(__DIR__.'/../../../../examples');
$path = realpath(dirname(__FILE__).'/../../../../examples');
$examples = array();
$handle = opendir($path);
@@ -28,7 +28,7 @@ class Mustache_Test_Functional_MustacheSpecTest extends PHPUnit_Framework_TestCa
* simply to provide a 'skipped' test if the `spec` submodule isn't initialized.
*/
public function testSpecInitialized() {
if (!file_exists(__DIR__.'/../../../../vendor/spec/specs/')) {
if (!file_exists(dirname(__FILE__).'/../../../../vendor/spec/specs/')) {
$this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"');
}
}
@@ -156,7 +156,7 @@ class Mustache_Test_Functional_MustacheSpecTest extends PHPUnit_Framework_TestCa
* @return array
*/
private function loadSpec($name) {
$filename = __DIR__ . '/../../../../vendor/spec/specs/' . $name . '.yml';
$filename = dirname(__FILE__) . '/../../../../vendor/spec/specs/' . $name . '.yml';
if (!file_exists($filename)) {
return array();
}
@@ -14,14 +14,14 @@
*/
class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCase {
public function testConstructor() {
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => '.ms'));
$this->assertEquals('alpha contents', $loader->load('alpha'));
$this->assertEquals('beta contents', $loader->load('beta.ms'));
}
public function testLoadTemplates() {
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
$this->assertEquals('one contents', $loader->load('one'));
$this->assertEquals('two contents', $loader->load('two.mustache'));
@@ -31,14 +31,14 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
* @expectedException \RuntimeException
*/
public function testMissingBaseDirThrowsException() {
$loader = new Mustache_Loader_FilesystemLoader(__DIR__.'/not_a_directory');
$loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/not_a_directory');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testMissingTemplateThrowsException() {
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
$loader->load('fake');
+2 -2
View File
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
require __DIR__.'/../src/Mustache/Autoloader.php';
require dirname(__FILE__).'/../src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
require __DIR__.'/../vendor/yaml/lib/sfYamlParser.php';
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php';