From f83a59d903fabc1ca61f1b20833c34776ce8c9a0 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 12 Jan 2017 10:01:49 +0100 Subject: [PATCH] #101 Filename getter (#102) * Update Compiler.php * Test for getFilename * Fix variable name * Fix dev dependencies compatibility --- composer.json | 3 ++- src/Jade/Compiler.php | 10 ++++++++++ tests/compiler/options.php | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 127ca66b..4ab60e4e 100644 --- a/composer.json +++ b/composer.json @@ -120,13 +120,14 @@ "role": "contributor" } ], + "minimum-stability": "stable", "require": { "php": ">=5.3.0", "js-phpize/js-phpize": "^1.2" }, "require-dev": { "phpunit/phpunit": ">=4.0", - "codeclimate/php-test-reporter": "dev-master" + "codeclimate/php-test-reporter": ">=0.3" }, "autoload": { "psr-0": { diff --git a/src/Jade/Compiler.php b/src/Jade/Compiler.php index cf56e72c..2a504a97 100644 --- a/src/Jade/Compiler.php +++ b/src/Jade/Compiler.php @@ -62,6 +62,16 @@ public function __construct($options = array(), array $filters = array(), $filen $this->jsPhpize = $jsPhpize; } + /** + * Get the filename passed to the compiler. + * + * @return Compiler + */ + public function getFilename() + { + return $this->filename; + } + /** * Get a compiler with the same settings. * diff --git a/tests/compiler/options.php b/tests/compiler/options.php index 9cb2b6cb..5754722e 100644 --- a/tests/compiler/options.php +++ b/tests/compiler/options.php @@ -27,4 +27,10 @@ public function testEngineOptions() $this->assertSame('@', $compiler->getOption('indentChar')); $this->assertSame('bar', $compiler->getOption('foo')); } + + public function testCompilerGetFilename() + { + $compiler = new Compiler(array(), array(), 'foobar'); + $this->assertSame('foobar', $compiler->getFilename()); + } }