Move examples into the test fixtures.

This commit is contained in:
Justin Hileman
2012-03-26 19:05:08 -07:00
parent 99a5e9b14a
commit 1430b27f86
77 changed files with 7 additions and 10 deletions
+3 -4
View File
@@ -22,8 +22,7 @@ This creates a new example and the corresponding files in the examples/ director
USAGE USAGE
); );
define('DS', DIRECTORY_SEPARATOR); define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'));
define('EXAMPLE_PATH', realpath(dirname(__FILE__) . DS . ".." . DS . "examples"));
/** /**
@@ -90,8 +89,8 @@ function out($value) {
* @return string * @return string
*/ */
function buildPath($directory, $filename = null, $extension = null) { function buildPath($directory, $filename = null, $extension = null) {
return out(EXAMPLE_PATH . DS . $directory. return out(EXAMPLE_PATH . '/' . $directory.
($extension !== null && $filename !== null ? DS . $filename. "." . $extension : "")); ($extension !== null && $filename !== null ? '/' . $filename. "." . $extension : ""));
} }
/** /**
@@ -35,18 +35,16 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
/** /**
* Data provider for testExamples method. * Data provider for testExamples method.
* *
* Assumes that an `examples` directory exists inside parent directory. * Loads examples from the test fixtures directory.
*
* This examples directory should contain any number of subdirectories, each of which contains * This examples directory should contain any number of subdirectories, each of which contains
* three files: one Mustache class (.php), one Mustache template (.mustache), and one output file * three files: one Mustache class (.php), one Mustache template (.mustache), and one output file
* (.txt). * (.txt). Optionally, the directory may contain a folder full of partials.
*
* This whole mess will be refined later to be more intuitive and less prescriptive, but it'll
* do for now. Especially since it means we can have unit tests :)
* *
* @return array * @return array
*/ */
public function getExamples() { public function getExamples() {
$path = realpath(dirname(__FILE__).'/../../../../examples'); $path = realpath(dirname(__FILE__).'/../../../fixtures/examples');
$examples = array(); $examples = array();
$handle = opendir($path); $handle = opendir($path);