diff --git a/.gitignore b/.gitignore
index 0cbbf4d2..00d98c5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,4 +11,3 @@ utilies/*.php
phpunit*
vendor/*
composer.lock
-templates_c/*
diff --git a/.travis.yml b/.travis.yml
index 44fb4eb1..b6f58bdb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,8 +30,6 @@ before_install:
install:
- travis_retry composer install
- - git clone --depth=50 --branch=master git://github.com/smarty-php/smarty-phpunit.git
script:
- - cd smarty-phpunit
- - ../vendor/bin/phpunit ./
+ - ./phpunit.sh
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 00000000..95896157
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,69 @@
+# Todo
+
+## Add unit test for strip issue in correct branch
+tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
+```
+@@ -76,6 +76,7 @@ class CompileStripTest extends PHPUnit_Smarty
+ array("{'Var'}\n ", 'Var ', '', $i ++),
+ array("\n ", ' ', '', $i ++),
+ array("\n\n ", '', '', $i ++),
++ array("\n\n {* a comment *}\n ", '', '', $i ++),
+
+ );
+ }
+```
+
+## Add unit test for isset issue in correct branch
+tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
+```php
+ /**
+ * test PHP isset() on (non-)variables
+ * @dataProvider dataTestIsset3
+ * @param string $strTemplate template to test
+ * @param string $result expected result
+ */
+ public function testIsset3($strTemplate, $result)
+ {
+ $this->smarty->disableSecurity();
+
+ $this->smarty->assign('varobject', new TestIsset());
+ $this->smarty->assign('vararray', $vararray = [
+ 'keythatexists' => false,
+ 'keywitharray' => [1 => 1],
+ 'keywithobject' => new TestIsset()]
+ );
+
+ $this->smarty->assign('key', 'A');
+ $this->smarty->assign('_varsimpleA', 1);
+ $this->smarty->assign('varsimpleB', 0);
+ $this->smarty->assign('varsimpleC', null);
+
+ $this->assertEquals($result, $this->smarty->fetch('string:' . $strTemplate));
+ }
+
+ /**
+ * Data provider for testIsset3
+ */
+ public function dataTestIsset3()
+ {
+ return array(
+ array('{if isset($varobject->arr)}true{else}false{/if}', 'true'),
+ array('{if isset($vararray["keywitharray"])}true{else}false{/if}', 'true'),
+ array('{if isset($vararray["keythatexists"])}true{else}false{/if}', 'true'),
+ array('{if isset($vararray["nonexistingkey"])}true{else}false{/if}', 'false'),
+ array('{if isset($_GET["sscr6hr6cz34j6"])}true{else}false{/if}', 'false'),
+ array('{if isset(count([\'hi\']))}true{else}false{/if}', 'true'),
+ array('{if isset($vararray[\'keywitharray\'][intval(\'1\')])}true{else}false{/if}', 'true'),
+ array('{if isset($vararray[\'keywithobject\']->arr[\'isSet\'])}true{else}false{/if}', 'true'),
+ array('{if isset($vararray[\'keywithobject\']->arr[\'isNull\'])}true{else}false{/if}', 'false'),
+ array('{if isset($varobject->arr[\'isSet\'])}true{else}false{/if}', 'true'),
+ array('{if isset($varobject->arr[\'isNull\'])}true{else}false{/if}', 'false'),
+ array('{if isset($_varsimpleA)}true{else}false{/if}', 'true'),
+ array('{if isset($varsimpleB)}true{else}false{/if}', 'true'),
+ array('{if isset($varsimpleC)}true{else}false{/if}', 'false'),
+ array('{if isset($_varsimpleA && varsimpleB)}true{else}false{/if}', 'true'),
+ array('{if isset($_varsimpleA && varsimpleC)}true{else}false{/if}', 'true'),
+ array('{if isset($_varsimple{$key})}true{else}false{/if}', 'true'),
+ );
+ }
+```
\ No newline at end of file
diff --git a/phpunit.sh b/phpunit.sh
old mode 100644
new mode 100755
index bf10b578..65935ab5
--- a/phpunit.sh
+++ b/phpunit.sh
@@ -1,3 +1,2 @@
#! /bin/bash
-
-php ../../phpunit/phpunit/phpunit ./
+vendor/phpunit/phpunit/phpunit tests/UnitTests
diff --git a/phpunit.xml.dist b/phpunit.xml
similarity index 61%
rename from phpunit.xml.dist
rename to phpunit.xml
index e3d3effe..e372eb80 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml
@@ -1,7 +1,7 @@
- UnitTests
+ tests/UnitTests
- ./
- cache
- templates_c
+ tests
+ tests/cache
+ tests/templates_c
- ../smarty/libs
- ../smarty/libs/plugins
- ../smarty/libs/sysplugins
- ../smarty/demo/plugins
+ libs
+ libs/plugins
+ libs/sysplugins
+ demo/plugins
-
+
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 7b2a5fe4..b3e05a8c 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -6,30 +6,9 @@
/*
* Smarty PHPUnit Bootstrap
*/
-include_once dirname(__FILE__) . '/Config.php';
-if (!class_exists('Smarty_Autoloader')) {
- if (is_file(dirname(__FILE__) . '/../smarty/libs/bootstrap.php')) {
- require_once dirname(__FILE__) . '/../smarty/libs/bootstrap.php';
- } elseif (is_file(dirname(__FILE__) . '/../libs/bootstrap.php')) {
- require_once dirname(__FILE__) . '/../libs/bootstrap.php';
- } else {
- throw new Exception('can not locate Smarty distribution');
- }
-}
-
-if (!defined('SMARTY_COMPOSER_INSTALL')) {
- foreach (array(dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../vendor/autoload.php',
- dirname(__FILE__) . '/vendor/autoload.php') as $file) {
- if (file_exists($file)) {
- define('SMARTY_COMPOSER_INSTALL', $file);
- break;
- }
- }
- unset($file);
-}
-if (!class_exists('PHPUnit_Framework_TestCase') && !class_exists('\PHPUnit\Framework\TestCase')){
- require_once SMARTY_COMPOSER_INSTALL;
-}
+require_once dirname(__FILE__) . '/Config.php';
+require_once dirname(__FILE__) . '/../vendor/autoload.php';
+require_once dirname(__FILE__) . '/../libs/bootstrap.php';
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
diff --git a/tests/UnitTests/A_Core/Filter/templates_c/.gitignore b/tests/UnitTests/A_Core/Filter/templates_c/.gitignore
index f26ba8a5..d88cc144 100644
--- a/tests/UnitTests/A_Core/Filter/templates_c/.gitignore
+++ b/tests/UnitTests/A_Core/Filter/templates_c/.gitignore
@@ -1,2 +1,2 @@
-dummy# Ignore anything in here, but keep this directory
- *
\ No newline at end of file
+# Ignore anything in here, but keep this directory
+*
diff --git a/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php b/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
index 43913d66..8892a542 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
@@ -156,57 +156,6 @@ class PhpFunctionTest extends PHPUnit_Smarty
,{if isset($var->pass(1))} true {else} false {/IF}
'));
}
-
- /**
- * test PHP isset() on (non-)variables
- * @dataProvider dataTestIsset3
- * @param string $strTemplate template to test
- * @param string $result expected result
- */
- public function testIsset3($strTemplate, $result)
- {
- $this->smarty->disableSecurity();
-
- $this->smarty->assign('varobject', new TestIsset());
- $this->smarty->assign('vararray', $vararray = [
- 'keythatexists' => false,
- 'keywitharray' => [1 => 1],
- 'keywithobject' => new TestIsset()]
- );
-
- $this->smarty->assign('key', 'A');
- $this->smarty->assign('_varsimpleA', 1);
- $this->smarty->assign('varsimpleB', 0);
- $this->smarty->assign('varsimpleC', null);
-
- $this->assertEquals($result, $this->smarty->fetch('string:' . $strTemplate));
- }
-
- /**
- * Data provider for testIsset3
- */
- public function dataTestIsset3()
- {
- return array(
- array('{if isset($varobject->arr)}true{else}false{/if}', 'true'),
- array('{if isset($vararray["keywitharray"])}true{else}false{/if}', 'true'),
- array('{if isset($vararray["keythatexists"])}true{else}false{/if}', 'true'),
- array('{if isset($vararray["nonexistingkey"])}true{else}false{/if}', 'false'),
- array('{if isset($_GET["sscr6hr6cz34j6"])}true{else}false{/if}', 'false'),
- array('{if isset(count([\'hi\']))}true{else}false{/if}', 'true'),
- array('{if isset($vararray[\'keywitharray\'][intval(\'1\')])}true{else}false{/if}', 'true'),
- array('{if isset($vararray[\'keywithobject\']->arr[\'isSet\'])}true{else}false{/if}', 'true'),
- array('{if isset($vararray[\'keywithobject\']->arr[\'isNull\'])}true{else}false{/if}', 'false'),
- array('{if isset($varobject->arr[\'isSet\'])}true{else}false{/if}', 'true'),
- array('{if isset($varobject->arr[\'isNull\'])}true{else}false{/if}', 'false'),
- array('{if isset($_varsimpleA)}true{else}false{/if}', 'true'),
- array('{if isset($varsimpleB)}true{else}false{/if}', 'true'),
- array('{if isset($varsimpleC)}true{else}false{/if}', 'false'),
- array('{if isset($_varsimpleA && varsimpleB)}true{else}false{/if}', 'true'),
- array('{if isset($_varsimpleA && varsimpleC)}true{else}false{/if}', 'true'),
- array('{if isset($_varsimple{$key})}true{else}false{/if}', 'true'),
- );
- }
}
/**