guard-mthaml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +34 -0
- data/lib/guard/mthaml.rb +140 -0
- data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
- data/lib/guard/mthaml/templates/Guardfile +12 -0
- data/lib/guard/mthaml/version.rb +5 -0
- data/vendor/autoload.php +7 -0
- data/vendor/coffeescript/coffeescript/LICENSE +22 -0
- data/vendor/coffeescript/coffeescript/README.md +96 -0
- data/vendor/coffeescript/coffeescript/composer.json +23 -0
- data/vendor/coffeescript/coffeescript/grammar.y +309 -0
- data/vendor/coffeescript/coffeescript/make.php +115 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
- data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
- data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
- data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
- data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
- data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
- data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
- data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
- data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
- data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
- data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
- data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
- data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
- data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
- data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
- data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
- data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
- data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
- data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
- data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
- data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
- data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
- data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
- data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
- data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
- data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
- data/vendor/composer/ClassLoader.php +383 -0
- data/vendor/composer/autoload_classmap.php +9 -0
- data/vendor/composer/autoload_namespaces.php +12 -0
- data/vendor/composer/autoload_psr4.php +10 -0
- data/vendor/composer/autoload_real.php +50 -0
- data/vendor/composer/installed.json +166 -0
- data/vendor/michelf/php-markdown/License.md +36 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
- data/vendor/michelf/php-markdown/Readme.md +305 -0
- data/vendor/michelf/php-markdown/Readme.php +31 -0
- data/vendor/michelf/php-markdown/composer.json +31 -0
- data/vendor/mthaml/mthaml/CHANGELOG +48 -0
- data/vendor/mthaml/mthaml/LICENSE +44 -0
- data/vendor/mthaml/mthaml/README.markdown +262 -0
- data/vendor/mthaml/mthaml/composer.json +45 -0
- data/vendor/mthaml/mthaml/docs/Makefile +153 -0
- data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
- data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
- data/vendor/mthaml/mthaml/docs/conf.py +242 -0
- data/vendor/mthaml/mthaml/docs/index.rst +18 -0
- data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
- data/vendor/mthaml/mthaml/examples/README.md +5 -0
- data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
- data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
- data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
- data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
- data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
- data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
- data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
- data/vendor/mthaml/mthaml/phpunit.xml +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
- data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
- metadata +398 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests;
|
4
|
+
|
5
|
+
require_once __DIR__ . '/TestCase.php';
|
6
|
+
|
7
|
+
class EnvironmentTest extends TestCase
|
8
|
+
{
|
9
|
+
/** @dataProvider getEnvironmentTests */
|
10
|
+
public function testEnvironment($file)
|
11
|
+
{
|
12
|
+
$parts = $this->parseTestFile($file);
|
13
|
+
|
14
|
+
file_put_contents($file . '.haml', $parts['HAML']);
|
15
|
+
file_put_contents($file . '.php', $parts['FILE']);
|
16
|
+
file_put_contents($file . '.exp', $parts['EXPECT']);
|
17
|
+
|
18
|
+
try {
|
19
|
+
ob_start();
|
20
|
+
require $file . '.php';
|
21
|
+
$out = ob_get_clean();
|
22
|
+
} catch (\Exception $e) {
|
23
|
+
$this->assertException($parts, $e);
|
24
|
+
$this->cleanup($file);
|
25
|
+
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
$this->assertException($parts);
|
29
|
+
|
30
|
+
file_put_contents($file . '.out', $out);
|
31
|
+
|
32
|
+
$this->assertSame($parts['EXPECT'], $out);
|
33
|
+
|
34
|
+
$this->cleanup($file);
|
35
|
+
}
|
36
|
+
|
37
|
+
protected function cleanup($file)
|
38
|
+
{
|
39
|
+
if (file_exists($file . '.out')) {
|
40
|
+
unlink($file . '.out');
|
41
|
+
}
|
42
|
+
unlink($file . '.haml');
|
43
|
+
unlink($file . '.php');
|
44
|
+
unlink($file . '.exp');
|
45
|
+
}
|
46
|
+
|
47
|
+
public function getEnvironmentTests()
|
48
|
+
{
|
49
|
+
if (false !== $tests = getenv('ENV_TESTS')) {
|
50
|
+
$files = explode(' ', $tests);
|
51
|
+
} else {
|
52
|
+
$files = glob(__DIR__ . '/fixtures/environment/*.test');
|
53
|
+
}
|
54
|
+
|
55
|
+
return array_map(function ($file) {
|
56
|
+
return array($file);
|
57
|
+
}, $files);
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests;
|
4
|
+
|
5
|
+
use MtHaml\Environment;
|
6
|
+
use MtHaml\Support\Twig\Extension;
|
7
|
+
|
8
|
+
class HamlSpecTest extends \PHPUnit_Framework_TestCase
|
9
|
+
{
|
10
|
+
/**
|
11
|
+
* @dataProvider getTestData
|
12
|
+
*/
|
13
|
+
public function testSpec($name, $test)
|
14
|
+
{
|
15
|
+
if (!getenv('HAML_SPEC_TEST_JSON_PATH')) {
|
16
|
+
$this->markTestSkipped('HAML_SPEC_TEST_JSON_PATH not set');
|
17
|
+
}
|
18
|
+
|
19
|
+
$config = array(
|
20
|
+
'enable_escaper' => false,
|
21
|
+
);
|
22
|
+
|
23
|
+
if (isset($test['config'])) {
|
24
|
+
foreach ($test['config'] as $key => $value) {
|
25
|
+
switch ($key) {
|
26
|
+
case 'format':
|
27
|
+
$config['format'] = $value;
|
28
|
+
break;
|
29
|
+
default:
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
$locals = array();
|
35
|
+
|
36
|
+
if (isset($test['locals'])) {
|
37
|
+
$locals = $test['locals'];
|
38
|
+
}
|
39
|
+
|
40
|
+
$env = new Environment('twig', $config);
|
41
|
+
$str = $env->compileString($test['haml'], "$name.haml");
|
42
|
+
|
43
|
+
$loader = new \Twig_Loader_Array(array(
|
44
|
+
'test.twig' => $str,
|
45
|
+
));
|
46
|
+
$twig = new \Twig_Environment($loader);
|
47
|
+
$twig->addExtension(new Extension);
|
48
|
+
|
49
|
+
$html = $twig->render('test.twig', $locals);
|
50
|
+
|
51
|
+
$expect = $test['html'];
|
52
|
+
|
53
|
+
$this->assertSame($expect, rtrim($html));
|
54
|
+
}
|
55
|
+
|
56
|
+
public function getTestData()
|
57
|
+
{
|
58
|
+
$inputPath = getenv('HAML_SPEC_TEST_JSON_PATH');
|
59
|
+
if (!$inputPath) {
|
60
|
+
return array(array(null, null));
|
61
|
+
}
|
62
|
+
|
63
|
+
$input = json_decode(file_get_contents($inputPath), true);
|
64
|
+
|
65
|
+
return $this->genData($input);
|
66
|
+
}
|
67
|
+
|
68
|
+
private function genData($input, $prefix = '')
|
69
|
+
{
|
70
|
+
$data = array();
|
71
|
+
|
72
|
+
foreach ($input as $key => $value) {
|
73
|
+
if (!isset($value['haml'])) {
|
74
|
+
$data = array_merge($data, $this->genData($value, $prefix.$key.': '));
|
75
|
+
} else {
|
76
|
+
$name = $prefix.$key.': ';
|
77
|
+
$data[$name] = array($name, $value);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return $data;
|
82
|
+
}
|
83
|
+
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests;
|
4
|
+
|
5
|
+
use MtHaml\Indentation\Undefined;
|
6
|
+
|
7
|
+
class IndentationTest extends \PHPUnit_Framework_TestCase
|
8
|
+
{
|
9
|
+
/** @dataProvider getTransitionData */
|
10
|
+
public function testTransition($expectChar, $expectWidth, $expectLevel, $expectString, array $transitions)
|
11
|
+
{
|
12
|
+
$i = new Undefined();
|
13
|
+
foreach ($transitions as $transition) {
|
14
|
+
$i = $i->newLevel($transition);
|
15
|
+
}
|
16
|
+
$this->assertSame($expectChar, $i->getChar());
|
17
|
+
$this->assertSame($expectWidth, $i->getWidth());
|
18
|
+
$this->assertSame($expectLevel, $i->getLevel());
|
19
|
+
$this->assertSame($expectString, $i->getString());
|
20
|
+
}
|
21
|
+
|
22
|
+
public function getTransitionData()
|
23
|
+
{
|
24
|
+
return array(
|
25
|
+
'none' => array(
|
26
|
+
'char' => null,
|
27
|
+
'width' => null,
|
28
|
+
'level' => 0,
|
29
|
+
'string' => '',
|
30
|
+
array(''),
|
31
|
+
),
|
32
|
+
'one' => array(
|
33
|
+
'char' => ' ',
|
34
|
+
'width' => 2,
|
35
|
+
'level' => 1,
|
36
|
+
'string' => ' ',
|
37
|
+
array(' '),
|
38
|
+
),
|
39
|
+
'two' => array(
|
40
|
+
'char' => ' ',
|
41
|
+
'width' => 2,
|
42
|
+
'level' => 2,
|
43
|
+
'string' => ' ',
|
44
|
+
array(' ', ' '),
|
45
|
+
),
|
46
|
+
'two, 3 spaces' => array(
|
47
|
+
'char' => ' ',
|
48
|
+
'width' => 3,
|
49
|
+
'level' => 2,
|
50
|
+
'string' => ' ',
|
51
|
+
array(' ', ' '),
|
52
|
+
),
|
53
|
+
'two, 4 spaces' => array(
|
54
|
+
'char' => ' ',
|
55
|
+
'width' => 4,
|
56
|
+
'level' => 2,
|
57
|
+
'string' => ' ',
|
58
|
+
array(' ', ' '),
|
59
|
+
),
|
60
|
+
'two, tabs' => array(
|
61
|
+
'char' => "\t",
|
62
|
+
'width' => 1,
|
63
|
+
'level' => 2,
|
64
|
+
'string' => "\t\t",
|
65
|
+
array("\t", "\t\t"),
|
66
|
+
),
|
67
|
+
'same level' => array(
|
68
|
+
'char' => ' ',
|
69
|
+
'width' => 2,
|
70
|
+
'level' => 2,
|
71
|
+
'string' => ' ',
|
72
|
+
array(' ', ' ', ' '),
|
73
|
+
),
|
74
|
+
'undent' => array(
|
75
|
+
'char' => ' ',
|
76
|
+
'width' => 2,
|
77
|
+
'level' => 1,
|
78
|
+
'string' => ' ',
|
79
|
+
array(' ', ' ', ' '),
|
80
|
+
),
|
81
|
+
'undent many' => array(
|
82
|
+
'char' => ' ',
|
83
|
+
'width' => 2,
|
84
|
+
'level' => 1,
|
85
|
+
'string' => ' ',
|
86
|
+
array(' ', ' ', ' ', ' '),
|
87
|
+
),
|
88
|
+
'undent to zero' => array(
|
89
|
+
'char' => ' ',
|
90
|
+
'width' => 2,
|
91
|
+
'level' => 0,
|
92
|
+
'string' => '',
|
93
|
+
array(' ', ' ', ' ', ''),
|
94
|
+
),
|
95
|
+
);
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @expectedException MtHaml\Indentation\IndentationException
|
100
|
+
* @expectedExceptionMessage Indentation can use only tabs or spaces
|
101
|
+
*/
|
102
|
+
public function testOnlySpacesAndTabsAreAllowed()
|
103
|
+
{
|
104
|
+
$i = new Undefined();
|
105
|
+
$i->newLevel("_");
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* @expectedException MtHaml\Indentation\IndentationException
|
110
|
+
* @expectedExceptionMessage Indentation can't use both tabs and spaces
|
111
|
+
*/
|
112
|
+
public function testCanNotMixTabsAndSpaces()
|
113
|
+
{
|
114
|
+
$i = new Undefined();
|
115
|
+
$i->newLevel(" \t");
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @expectedException MtHaml\Indentation\IndentationException
|
120
|
+
* @expectedExceptionMessage The line was indented more than one level deeper than the previous line
|
121
|
+
*/
|
122
|
+
public function testCanOnlyIndentOneLevelAtOnce()
|
123
|
+
{
|
124
|
+
$i = new Undefined();
|
125
|
+
$i = $i->newLevel(" ");
|
126
|
+
$i = $i->newLevel(" ");
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* @expectedException MtHaml\Indentation\IndentationException
|
131
|
+
* @expectedExceptionMessage Inconsistent indentation: 3 is not a multiple of 2
|
132
|
+
*/
|
133
|
+
public function testWidthMustBeConsistent()
|
134
|
+
{
|
135
|
+
$i = new Undefined();
|
136
|
+
$i = $i->newLevel(" ");
|
137
|
+
$i = $i->newLevel(" ");
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests\Node;
|
4
|
+
|
5
|
+
use MtHaml\Node\Doctype;
|
6
|
+
|
7
|
+
class DoctypeTest extends \PHPUnit_Framework_TestCase
|
8
|
+
{
|
9
|
+
/** @dataProvider getGetDoctypeReturnsDefaultOneWhenInvalidData */
|
10
|
+
public function testGetDoctypeReturnsDefaultOneWhenInvalid($format, $doctype)
|
11
|
+
{
|
12
|
+
$node = new Doctype(array('lineno' => 0, 'column' => 0), 'invalid', null);
|
13
|
+
|
14
|
+
$result = @$node->getDoctype($format);
|
15
|
+
$this->assertSame($doctype, $result);
|
16
|
+
}
|
17
|
+
|
18
|
+
public function getGetDoctypeReturnsDefaultOneWhenInvalidData()
|
19
|
+
{
|
20
|
+
return array(
|
21
|
+
array('html5', '<!DOCTYPE html>'),
|
22
|
+
array('xhtml', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'),
|
23
|
+
);
|
24
|
+
}
|
25
|
+
|
26
|
+
/** @dataProvider getGetDoctypeTriggersWarningWhenInvalidData */
|
27
|
+
public function testGetDoctypeTriggersWarningWhenInvalid($format, $msg)
|
28
|
+
{
|
29
|
+
$node = new Doctype(array('lineno' => 0, 'column' => 0), 'invalid', null);
|
30
|
+
|
31
|
+
$e = null;
|
32
|
+
|
33
|
+
try {
|
34
|
+
$node->getDoctype($format);
|
35
|
+
} catch (\Exception $e) {
|
36
|
+
}
|
37
|
+
|
38
|
+
$this->assertNotNull($e);
|
39
|
+
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
40
|
+
$this->assertSame($msg, $e->getMessage());
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
public function getGetDoctypeTriggersWarningWhenInvalidData()
|
45
|
+
{
|
46
|
+
return array(
|
47
|
+
array('html5', "No such doctype '!!! invalid' for the format 'html5'. Available doctypes for the current format are: '!!!', '!!! 5'"),
|
48
|
+
array('xhtml', "No such doctype '!!! invalid' for the format 'xhtml'. Available doctypes for the current format are: '!!!', '!!! strict', '!!! frameset', '!!! 5', '!!! 1.1', '!!! basic', '!!! mobile', '!!! rdfa'"),
|
49
|
+
);
|
50
|
+
}
|
51
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace MtHaml\Tests\Node;
|
4
|
+
|
5
|
+
use MtHaml\Node\Tag;
|
6
|
+
|
7
|
+
class NodeTest extends \PHPUnit_Framework_TestCase
|
8
|
+
{
|
9
|
+
protected function createNodes()
|
10
|
+
{
|
11
|
+
$node = new Tag(array(), 'div', array());
|
12
|
+
$this->assertFalse($node->hasChilds());
|
13
|
+
|
14
|
+
$nodeB = new Tag(array(), 'div', array());
|
15
|
+
$node->addChild($nodeB);
|
16
|
+
|
17
|
+
$this->assertTrue($node->hasChilds());
|
18
|
+
$this->assertSame($node, $nodeB->getParent());
|
19
|
+
|
20
|
+
$nodeC = new Tag(array(), 'div', array());
|
21
|
+
$node->addChild($nodeC);
|
22
|
+
$this->assertSame(2, count($node->getChilds()));
|
23
|
+
|
24
|
+
$this->assertSame($node, $nodeC->getParent());
|
25
|
+
|
26
|
+
$this->assertSame(null, $nodeB->getPreviousSibling());
|
27
|
+
$this->assertSame($nodeC, $nodeB->getNextSibling());
|
28
|
+
|
29
|
+
$this->assertSame($nodeB, $nodeC->getPreviousSibling());
|
30
|
+
$this->assertSame(null, $nodeC->getNextSibling());
|
31
|
+
|
32
|
+
$nodeD = new Tag(array(), 'div', array());
|
33
|
+
$node->addChild($nodeD);
|
34
|
+
|
35
|
+
$this->assertSame($nodeB, $nodeC->getPreviousSibling());
|
36
|
+
$this->assertSame($nodeD, $nodeC->getNextSibling());
|
37
|
+
|
38
|
+
return compact('node', 'nodeB', 'nodeC', 'nodeD');
|
39
|
+
}
|
40
|
+
|
41
|
+
public function testAddingNodes()
|
42
|
+
{
|
43
|
+
$this->createNodes();
|
44
|
+
}
|
45
|
+
|
46
|
+
public function testDeletingFirstChild()
|
47
|
+
{
|
48
|
+
extract($this->createNodes());
|
49
|
+
|
50
|
+
$node->removeChild($nodeB);
|
51
|
+
$this->assertSame(2, count($node->getChilds()));
|
52
|
+
|
53
|
+
$this->assertNull($nodeB->getParent());
|
54
|
+
$this->assertNull($nodeB->getPreviousSibling());
|
55
|
+
$this->assertNull($nodeB->getNextSibling());
|
56
|
+
|
57
|
+
$this->assertSame(null, $nodeC->getPreviousSibling());
|
58
|
+
$this->assertSame($nodeD, $nodeC->getNextSibling());
|
59
|
+
|
60
|
+
$this->assertSame($nodeC, $nodeD->getPreviousSibling());
|
61
|
+
$this->assertSame(null, $nodeD->getNextSibling());
|
62
|
+
}
|
63
|
+
|
64
|
+
public function testDeletingMiddleChild()
|
65
|
+
{
|
66
|
+
extract($this->createNodes());
|
67
|
+
|
68
|
+
$node->removeChild($nodeC);
|
69
|
+
$this->assertSame(2, count($node->getChilds()));
|
70
|
+
|
71
|
+
$this->assertNull($nodeC->getParent());
|
72
|
+
$this->assertNull($nodeC->getPreviousSibling());
|
73
|
+
$this->assertNull($nodeC->getNextSibling());
|
74
|
+
|
75
|
+
$this->assertSame(null, $nodeB->getPreviousSibling());
|
76
|
+
$this->assertSame($nodeD, $nodeB->getNextSibling());
|
77
|
+
|
78
|
+
$this->assertSame($nodeB, $nodeD->getPreviousSibling());
|
79
|
+
$this->assertSame(null, $nodeD->getNextSibling());
|
80
|
+
}
|
81
|
+
|
82
|
+
public function testDeletingLastChild()
|
83
|
+
{
|
84
|
+
extract($this->createNodes());
|
85
|
+
|
86
|
+
$node->removeChild($nodeD);
|
87
|
+
$this->assertSame(2, count($node->getChilds()));
|
88
|
+
|
89
|
+
$this->assertNull($nodeD->getParent());
|
90
|
+
$this->assertNull($nodeD->getPreviousSibling());
|
91
|
+
$this->assertNull($nodeD->getNextSibling());
|
92
|
+
|
93
|
+
$this->assertSame(null, $nodeB->getPreviousSibling());
|
94
|
+
$this->assertSame($nodeC, $nodeB->getNextSibling());
|
95
|
+
|
96
|
+
$this->assertSame($nodeB, $nodeC->getPreviousSibling());
|
97
|
+
$this->assertSame(null, $nodeC->getNextSibling());
|
98
|
+
}
|
99
|
+
|
100
|
+
public function testMovingNode()
|
101
|
+
{
|
102
|
+
extract($this->createNodes(), EXTR_PREFIX_ALL, 'src');
|
103
|
+
extract($this->createNodes(), EXTR_PREFIX_ALL, 'dst');
|
104
|
+
|
105
|
+
$dst_node->addChild($src_nodeC);
|
106
|
+
|
107
|
+
$this->assertSame(2, count($src_node->getChilds()));
|
108
|
+
$this->assertSame(4, count($dst_node->getChilds()));
|
109
|
+
}
|
110
|
+
}
|