Explorar o código

Move `examples` into the test fixtures.

Justin Hileman %!s(int64=13) %!d(string=hai) anos
pai
achega
1430b27f86
Modificáronse 77 ficheiros con 7 adicións e 10 borrados
  1. 3 4
      bin/create_example.php
  2. 4 6
      test/Mustache/Test/Functional/ExamplesTest.php
  3. 0 0
      test/fixtures/examples/child_context/ChildContext.php
  4. 0 0
      test/fixtures/examples/child_context/child_context.mustache
  5. 0 0
      test/fixtures/examples/child_context/child_context.txt
  6. 0 0
      test/fixtures/examples/comments/Comments.php
  7. 0 0
      test/fixtures/examples/comments/comments.mustache
  8. 0 0
      test/fixtures/examples/comments/comments.txt
  9. 0 0
      test/fixtures/examples/complex/complex.mustache
  10. 0 0
      test/fixtures/examples/complex/complex.php
  11. 0 0
      test/fixtures/examples/complex/complex.txt
  12. 0 0
      test/fixtures/examples/delimiters/Delimiters.php
  13. 0 0
      test/fixtures/examples/delimiters/delimiters.mustache
  14. 0 0
      test/fixtures/examples/delimiters/delimiters.txt
  15. 0 0
      test/fixtures/examples/dot_notation/DotNotation.php
  16. 0 0
      test/fixtures/examples/dot_notation/dot_notation.mustache
  17. 0 0
      test/fixtures/examples/dot_notation/dot_notation.txt
  18. 0 0
      test/fixtures/examples/double_section/DoubleSection.php
  19. 0 0
      test/fixtures/examples/double_section/double_section.mustache
  20. 0 0
      test/fixtures/examples/double_section/double_section.txt
  21. 0 0
      test/fixtures/examples/escaped/Escaped.php
  22. 0 0
      test/fixtures/examples/escaped/escaped.mustache
  23. 0 0
      test/fixtures/examples/escaped/escaped.txt
  24. 0 0
      test/fixtures/examples/grand_parent_context/GrandParentContext.php
  25. 0 0
      test/fixtures/examples/grand_parent_context/grand_parent_context.mustache
  26. 0 0
      test/fixtures/examples/grand_parent_context/grand_parent_context.txt
  27. 0 0
      test/fixtures/examples/i18n/I18n.php
  28. 0 0
      test/fixtures/examples/i18n/i18n.mustache
  29. 0 0
      test/fixtures/examples/i18n/i18n.txt
  30. 0 0
      test/fixtures/examples/implicit_iterator/ImplicitIterator.php
  31. 0 0
      test/fixtures/examples/implicit_iterator/implicit_iterator.mustache
  32. 0 0
      test/fixtures/examples/implicit_iterator/implicit_iterator.txt
  33. 0 0
      test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php
  34. 0 0
      test/fixtures/examples/inverted_double_section/inverted_double_section.mustache
  35. 0 0
      test/fixtures/examples/inverted_double_section/inverted_double_section.txt
  36. 0 0
      test/fixtures/examples/inverted_section/InvertedSection.php
  37. 0 0
      test/fixtures/examples/inverted_section/inverted_section.mustache
  38. 0 0
      test/fixtures/examples/inverted_section/inverted_section.txt
  39. 0 0
      test/fixtures/examples/partials/Partials.php
  40. 0 0
      test/fixtures/examples/partials/partials.mustache
  41. 0 0
      test/fixtures/examples/partials/partials.txt
  42. 0 0
      test/fixtures/examples/partials/partials/header.mustache
  43. 0 0
      test/fixtures/examples/recursive_partials/RecursivePartials.php
  44. 0 0
      test/fixtures/examples/recursive_partials/partials/child.mustache
  45. 0 0
      test/fixtures/examples/recursive_partials/recursive_partials.mustache
  46. 0 0
      test/fixtures/examples/recursive_partials/recursive_partials.txt
  47. 0 0
      test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php
  48. 0 0
      test/fixtures/examples/section_iterator_objects/section_iterator_objects.mustache
  49. 0 0
      test/fixtures/examples/section_iterator_objects/section_iterator_objects.txt
  50. 0 0
      test/fixtures/examples/section_magic_objects/SectionMagicObjects.php
  51. 0 0
      test/fixtures/examples/section_magic_objects/section_magic_objects.mustache
  52. 0 0
      test/fixtures/examples/section_magic_objects/section_magic_objects.txt
  53. 0 0
      test/fixtures/examples/section_objects/SectionObjects.php
  54. 0 0
      test/fixtures/examples/section_objects/section_objects.mustache
  55. 0 0
      test/fixtures/examples/section_objects/section_objects.txt
  56. 0 0
      test/fixtures/examples/sections/Sections.php
  57. 0 0
      test/fixtures/examples/sections/sections.mustache
  58. 0 0
      test/fixtures/examples/sections/sections.txt
  59. 0 0
      test/fixtures/examples/sections_nested/SectionsNested.php
  60. 0 0
      test/fixtures/examples/sections_nested/sections_nested.mustache
  61. 0 0
      test/fixtures/examples/sections_nested/sections_nested.txt
  62. 0 0
      test/fixtures/examples/simple/Simple.php
  63. 0 0
      test/fixtures/examples/simple/simple.mustache
  64. 0 0
      test/fixtures/examples/simple/simple.txt
  65. 0 0
      test/fixtures/examples/unescaped/Unescaped.php
  66. 0 0
      test/fixtures/examples/unescaped/unescaped.mustache
  67. 0 0
      test/fixtures/examples/unescaped/unescaped.txt
  68. 0 0
      test/fixtures/examples/utf8/UTF8.php
  69. 0 0
      test/fixtures/examples/utf8/utf8.mustache
  70. 0 0
      test/fixtures/examples/utf8/utf8.txt
  71. 0 0
      test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php
  72. 0 0
      test/fixtures/examples/utf8_unescaped/utf8_unescaped.mustache
  73. 0 0
      test/fixtures/examples/utf8_unescaped/utf8_unescaped.txt
  74. 0 0
      test/fixtures/examples/whitespace/Whitespace.php
  75. 0 0
      test/fixtures/examples/whitespace/partials/alphabet.mustache
  76. 0 0
      test/fixtures/examples/whitespace/whitespace.mustache
  77. 0 0
      test/fixtures/examples/whitespace/whitespace.txt

+ 3 - 4
bin/create_example.php

@@ -22,8 +22,7 @@ This creates a new example and the corresponding files in the examples/ director
 USAGE
 );
 
-define('DS', DIRECTORY_SEPARATOR);
-define('EXAMPLE_PATH', realpath(dirname(__FILE__) . DS . ".." . DS . "examples"));
+define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'));
 
 
 /**
@@ -90,8 +89,8 @@ function out($value) {
  * @return string
  */
 function buildPath($directory, $filename = null,  $extension = null) {
-	return out(EXAMPLE_PATH . DS . $directory.
-					($extension !== null && $filename !== null ? DS . $filename. "." . $extension : ""));
+	return out(EXAMPLE_PATH . '/' . $directory.
+					($extension !== null && $filename !== null ? '/' . $filename. "." . $extension : ""));
 }
 
 /**

+ 4 - 6
test/Mustache/Test/Functional/ExamplesTest.php

@@ -35,18 +35,16 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
 	/**
 	 * 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
 	 * three files: one Mustache class (.php), one Mustache template (.mustache), and one output file
-	 * (.txt).
-	 *
-	 * 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 :)
+	 * (.txt). Optionally, the directory may contain a folder full of partials.
 	 *
 	 * @return array
 	 */
 	public function getExamples() {
-		$path     = realpath(dirname(__FILE__).'/../../../../examples');
+		$path     = realpath(dirname(__FILE__).'/../../../fixtures/examples');
 		$examples = array();
 
 		$handle   = opendir($path);

+ 0 - 0
examples/child_context/ChildContext.php → test/fixtures/examples/child_context/ChildContext.php


+ 0 - 0
examples/child_context/child_context.mustache → test/fixtures/examples/child_context/child_context.mustache


+ 0 - 0
examples/child_context/child_context.txt → test/fixtures/examples/child_context/child_context.txt


+ 0 - 0
examples/comments/Comments.php → test/fixtures/examples/comments/Comments.php


+ 0 - 0
examples/comments/comments.mustache → test/fixtures/examples/comments/comments.mustache


+ 0 - 0
examples/comments/comments.txt → test/fixtures/examples/comments/comments.txt


+ 0 - 0
examples/complex/complex.mustache → test/fixtures/examples/complex/complex.mustache


+ 0 - 0
examples/complex/complex.php → test/fixtures/examples/complex/complex.php


+ 0 - 0
examples/complex/complex.txt → test/fixtures/examples/complex/complex.txt


+ 0 - 0
examples/delimiters/Delimiters.php → test/fixtures/examples/delimiters/Delimiters.php


+ 0 - 0
examples/delimiters/delimiters.mustache → test/fixtures/examples/delimiters/delimiters.mustache


+ 0 - 0
examples/delimiters/delimiters.txt → test/fixtures/examples/delimiters/delimiters.txt


+ 0 - 0
examples/dot_notation/DotNotation.php → test/fixtures/examples/dot_notation/DotNotation.php


+ 0 - 0
examples/dot_notation/dot_notation.mustache → test/fixtures/examples/dot_notation/dot_notation.mustache


+ 0 - 0
examples/dot_notation/dot_notation.txt → test/fixtures/examples/dot_notation/dot_notation.txt


+ 0 - 0
examples/double_section/DoubleSection.php → test/fixtures/examples/double_section/DoubleSection.php


+ 0 - 0
examples/double_section/double_section.mustache → test/fixtures/examples/double_section/double_section.mustache


+ 0 - 0
examples/double_section/double_section.txt → test/fixtures/examples/double_section/double_section.txt


+ 0 - 0
examples/escaped/Escaped.php → test/fixtures/examples/escaped/Escaped.php


+ 0 - 0
examples/escaped/escaped.mustache → test/fixtures/examples/escaped/escaped.mustache


+ 0 - 0
examples/escaped/escaped.txt → test/fixtures/examples/escaped/escaped.txt


+ 0 - 0
examples/grand_parent_context/GrandParentContext.php → test/fixtures/examples/grand_parent_context/GrandParentContext.php


+ 0 - 0
examples/grand_parent_context/grand_parent_context.mustache → test/fixtures/examples/grand_parent_context/grand_parent_context.mustache


+ 0 - 0
examples/grand_parent_context/grand_parent_context.txt → test/fixtures/examples/grand_parent_context/grand_parent_context.txt


+ 0 - 0
examples/i18n/I18n.php → test/fixtures/examples/i18n/I18n.php


+ 0 - 0
examples/i18n/i18n.mustache → test/fixtures/examples/i18n/i18n.mustache


+ 0 - 0
examples/i18n/i18n.txt → test/fixtures/examples/i18n/i18n.txt


+ 0 - 0
examples/implicit_iterator/ImplicitIterator.php → test/fixtures/examples/implicit_iterator/ImplicitIterator.php


+ 0 - 0
examples/implicit_iterator/implicit_iterator.mustache → test/fixtures/examples/implicit_iterator/implicit_iterator.mustache


+ 0 - 0
examples/implicit_iterator/implicit_iterator.txt → test/fixtures/examples/implicit_iterator/implicit_iterator.txt


+ 0 - 0
examples/inverted_double_section/InvertedDoubleSection.php → test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php


+ 0 - 0
examples/inverted_double_section/inverted_double_section.mustache → test/fixtures/examples/inverted_double_section/inverted_double_section.mustache


+ 0 - 0
examples/inverted_double_section/inverted_double_section.txt → test/fixtures/examples/inverted_double_section/inverted_double_section.txt


+ 0 - 0
examples/inverted_section/InvertedSection.php → test/fixtures/examples/inverted_section/InvertedSection.php


+ 0 - 0
examples/inverted_section/inverted_section.mustache → test/fixtures/examples/inverted_section/inverted_section.mustache


+ 0 - 0
examples/inverted_section/inverted_section.txt → test/fixtures/examples/inverted_section/inverted_section.txt


+ 0 - 0
examples/partials/Partials.php → test/fixtures/examples/partials/Partials.php


+ 0 - 0
examples/partials/partials.mustache → test/fixtures/examples/partials/partials.mustache


+ 0 - 0
examples/partials/partials.txt → test/fixtures/examples/partials/partials.txt


+ 0 - 0
examples/partials/partials/header.mustache → test/fixtures/examples/partials/partials/header.mustache


+ 0 - 0
examples/recursive_partials/RecursivePartials.php → test/fixtures/examples/recursive_partials/RecursivePartials.php


+ 0 - 0
examples/recursive_partials/partials/child.mustache → test/fixtures/examples/recursive_partials/partials/child.mustache


+ 0 - 0
examples/recursive_partials/recursive_partials.mustache → test/fixtures/examples/recursive_partials/recursive_partials.mustache


+ 0 - 0
examples/recursive_partials/recursive_partials.txt → test/fixtures/examples/recursive_partials/recursive_partials.txt


+ 0 - 0
examples/section_iterator_objects/SectionIteratorObjects.php → test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php


+ 0 - 0
examples/section_iterator_objects/section_iterator_objects.mustache → test/fixtures/examples/section_iterator_objects/section_iterator_objects.mustache


+ 0 - 0
examples/section_iterator_objects/section_iterator_objects.txt → test/fixtures/examples/section_iterator_objects/section_iterator_objects.txt


+ 0 - 0
examples/section_magic_objects/SectionMagicObjects.php → test/fixtures/examples/section_magic_objects/SectionMagicObjects.php


+ 0 - 0
examples/section_magic_objects/section_magic_objects.mustache → test/fixtures/examples/section_magic_objects/section_magic_objects.mustache


+ 0 - 0
examples/section_magic_objects/section_magic_objects.txt → test/fixtures/examples/section_magic_objects/section_magic_objects.txt


+ 0 - 0
examples/section_objects/SectionObjects.php → test/fixtures/examples/section_objects/SectionObjects.php


+ 0 - 0
examples/section_objects/section_objects.mustache → test/fixtures/examples/section_objects/section_objects.mustache


+ 0 - 0
examples/section_objects/section_objects.txt → test/fixtures/examples/section_objects/section_objects.txt


+ 0 - 0
examples/sections/Sections.php → test/fixtures/examples/sections/Sections.php


+ 0 - 0
examples/sections/sections.mustache → test/fixtures/examples/sections/sections.mustache


+ 0 - 0
examples/sections/sections.txt → test/fixtures/examples/sections/sections.txt


+ 0 - 0
examples/sections_nested/SectionsNested.php → test/fixtures/examples/sections_nested/SectionsNested.php


+ 0 - 0
examples/sections_nested/sections_nested.mustache → test/fixtures/examples/sections_nested/sections_nested.mustache


+ 0 - 0
examples/sections_nested/sections_nested.txt → test/fixtures/examples/sections_nested/sections_nested.txt


+ 0 - 0
examples/simple/Simple.php → test/fixtures/examples/simple/Simple.php


+ 0 - 0
examples/simple/simple.mustache → test/fixtures/examples/simple/simple.mustache


+ 0 - 0
examples/simple/simple.txt → test/fixtures/examples/simple/simple.txt


+ 0 - 0
examples/unescaped/Unescaped.php → test/fixtures/examples/unescaped/Unescaped.php


+ 0 - 0
examples/unescaped/unescaped.mustache → test/fixtures/examples/unescaped/unescaped.mustache


+ 0 - 0
examples/unescaped/unescaped.txt → test/fixtures/examples/unescaped/unescaped.txt


+ 0 - 0
examples/utf8/UTF8.php → test/fixtures/examples/utf8/UTF8.php


+ 0 - 0
examples/utf8/utf8.mustache → test/fixtures/examples/utf8/utf8.mustache


+ 0 - 0
examples/utf8/utf8.txt → test/fixtures/examples/utf8/utf8.txt


+ 0 - 0
examples/utf8_unescaped/UTF8Unescaped.php → test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php


+ 0 - 0
examples/utf8_unescaped/utf8_unescaped.mustache → test/fixtures/examples/utf8_unescaped/utf8_unescaped.mustache


+ 0 - 0
examples/utf8_unescaped/utf8_unescaped.txt → test/fixtures/examples/utf8_unescaped/utf8_unescaped.txt


+ 0 - 0
examples/whitespace/Whitespace.php → test/fixtures/examples/whitespace/Whitespace.php


+ 0 - 0
examples/whitespace/partials/alphabet.mustache → test/fixtures/examples/whitespace/partials/alphabet.mustache


+ 0 - 0
examples/whitespace/whitespace.mustache → test/fixtures/examples/whitespace/whitespace.mustache


+ 0 - 0
examples/whitespace/whitespace.txt → test/fixtures/examples/whitespace/whitespace.txt