From 439f66cdfe7739df3441a73266a726ee76e2499f Mon Sep 17 00:00:00 2001 From: bnu Date: Mon, 27 Jun 2016 19:19:24 +0900 Subject: [PATCH] =?UTF-8?q?travis-ci=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=EC=84=B1=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 +- codeception.dist.yml | 2 +- composer.json | 4 +- tests/Install.suite.dist.yml | 8 +- .../frontendfile/FrontEndFileHandlerTest.php | 451 ++++++++++-------- .../classes/template/TemplateHandlerTest.php | 1 - 6 files changed, 249 insertions(+), 221 deletions(-) diff --git a/.travis.yml b/.travis.yml index a7a3f4b38c..efeb2698d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,8 @@ before_script: - phpenv config-rm xdebug.ini - if [ $(phpenv version-name) != "5.3" ]; then composer install; fi - if [ $(phpenv version-name) != "5.3" ]; then mysql -e 'create database xe_test;'; fi -- if [ $(phpenv version-name) != "5.3" ]; then echo "USE mysql;\nUPDATE user SET password=PASSWORD('travis') - WHERE user='travis';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi +- if [ $(phpenv version-name) != "5.3" ]; then echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') + WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi - if [ $(phpenv version-name) != "5.3" ]; then php -S localhost:8000 & fi script: - grunt lint diff --git a/codeception.dist.yml b/codeception.dist.yml index db57ec19b1..f178bf75b0 100644 --- a/codeception.dist.yml +++ b/codeception.dist.yml @@ -7,5 +7,5 @@ paths: settings: bootstrap: _bootstrap.php colors: true - memory_limit: 1024M + memory_limit: 2048M error_level: "E_ALL & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED & ~E_NOTICE" diff --git a/composer.json b/composer.json index 94cc491b3c..3197ae3a93 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,6 @@ "php": ">=5.4.0" }, "require-dev": { - "codeception/codeception": "~2.0", - "codeception/verify": "0.2.*", - "codeception/specify": "0.4.*" + "codeception/codeception": "~2.0" } } diff --git a/tests/Install.suite.dist.yml b/tests/Install.suite.dist.yml index b217a1c353..6bb43518bb 100644 --- a/tests/Install.suite.dist.yml +++ b/tests/Install.suite.dist.yml @@ -19,10 +19,10 @@ env: config: Db: dsn: 'mysql:host=127.0.0.1;dbname=xe_test' - user: 'travis' - password: 'travis' + user: 'root' + password: 'root' cleanup: true DbDropTablesHelper: dsn: 'mysql:host=127.0.0.1;dbname=xe_test' - user: 'travis' - password: 'travis' + user: 'root' + password: 'root' diff --git a/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php b/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php index beefd25129..90d9aa6061 100644 --- a/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php +++ b/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php @@ -3,225 +3,256 @@ class FrontEndFileHandlerTest extends \Codeception\TestCase\Test { - use \Codeception\Specify; - private function _filemtime($file) { return '?' . date('YmdHis', filemtime(_XE_PATH_ . $file)); } - public function testFrontEndFileHandler() + public function testFrontEndFileHandler001() + { + // js(head) + $handler = new FrontEndFileHandler(); + + $handler->loadFile(array('./common/js/jquery.js')); + $handler->loadFile(array('./common/js/js_app.js', 'head')); + $handler->loadFile(array('./common/js/common.js', 'body')); + $handler->loadFile(array('./common/js/common.js', 'head')); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'body')); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); + } else { + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); + } + $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler002() + { + $handler = new FrontEndFileHandler(); + + // js(body) + $handler->loadFile(array('./common/js/jquery.js', 'body')); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'head')); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); + } + else + { + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); + } + $this->assertEquals($handler->getJsFileList('body'), $expected); + } + + public function testFrontEndFileHandler003() + { + $handler = new FrontEndFileHandler(); + + // css + $handler->loadFile(array('./common/css/xe.css')); + $handler->loadFile(array('./common/css/mobile.css')); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/css/xe.css' . $this->_filemtime('common/css/xe.css'), 'media' => 'all', 'targetie' => null); + $expected[] = array('file' => '/xe/common/css/mobile.css' . $this->_filemtime('common/css/mobile.css'), 'media' => 'all', 'targetie' => null); + } + else + { + $expected[] = array('file' => '/xe/common/css/xe.min.css' . $this->_filemtime('common/css/xe.min.css'), 'media' => 'all', 'targetie' => null); + $expected[] = array('file' => '/xe/common/css/mobile.min.css' . $this->_filemtime('common/css/mobile.min.css'), 'media' => 'all', 'targetie' => null); + } + $this->assertEquals($handler->getCssFileList(), $expected); + } + + public function testFrontEndFileHandler004() + { + $handler = new FrontEndFileHandler(); + + // order (duplicate) + $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); + } + else + { + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); + } + $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler005() + { + $handler = new FrontEndFileHandler(); + + // order (redefine) + $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', 1)); + $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); + } + else + { + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); + } + $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler006() + { + $handler = new FrontEndFileHandler(); + + // unload + $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); + $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); + $handler->unloadFile('./common/js/jquery.js', '', 'all'); + + $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); + $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler007() { $handler = new FrontEndFileHandler(); - $this->specify("js(head)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/jquery.js')); - $handler->loadFile(array('./common/js/js_app.js', 'head')); - $handler->loadFile(array('./common/js/common.js', 'body')); - $handler->loadFile(array('./common/js/common.js', 'head')); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'body')); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); - } else { - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); - } - $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("js(body)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/jquery.js', 'body')); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'head')); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); - } - else - { - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); - } - $this->assertEquals($handler->getJsFileList('body'), $expected); - }); - - $this->specify("css", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/css/xe.css')); - $handler->loadFile(array('./common/css/mobile.css')); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/css/xe.css' . $this->_filemtime('common/css/xe.css'), 'media' => 'all', 'targetie' => null); - $expected[] = array('file' => '/xe/common/css/mobile.css' . $this->_filemtime('common/css/mobile.css'), 'media' => 'all', 'targetie' => null); - } - else - { - $expected[] = array('file' => '/xe/common/css/xe.min.css' . $this->_filemtime('common/css/xe.min.css'), 'media' => 'all', 'targetie' => null); - $expected[] = array('file' => '/xe/common/css/mobile.min.css' . $this->_filemtime('common/css/mobile.min.css'), 'media' => 'all', 'targetie' => null); - } - $this->assertEquals($handler->getCssFileList(), $expected); - }); - - $this->specify("order (duplicate)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); - } - else - { - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); - } - $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("order (redefine)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', 1)); - $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => null); - } - else - { - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => null); - } - $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("unload", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/jquery.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/js_app.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/common.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000)); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000)); - $handler->unloadFile('./common/js/jquery.js', '', 'all'); - - $expected[] = array('file' => '/xe/common/js/js_app.js' . $this->_filemtime('common/js/js_app.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/common.js' . $this->_filemtime('common/js/common.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_handler.js' . $this->_filemtime('common/js/xml_handler.js'), 'targetie' => null); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js' . $this->_filemtime('common/js/xml_js_filter.js'), 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("target IE(js)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie6')); - $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie7')); - $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie8')); - - if(__DEBUG__ || !__XE_VERSION_STABLE__) - { - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie6'); - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie7'); - $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie8'); - } - else - { - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie6'); - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie7'); - $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie8'); - } - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("external file - schemaless", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('http://external.host/js/script.js')); - $handler->loadFile(array('https://external.host/js/script.js')); - $handler->loadFile(array('//external.host/js/script1.js')); - $handler->loadFile(array('///external.host/js/script2.js')); - - $expected[] = array('file' => 'http://external.host/js/script.js', 'targetie' => null); - $expected[] = array('file' => 'https://external.host/js/script.js', 'targetie' => null); - $expected[] = array('file' => '//external.host/js/script1.js', 'targetie' => null); - $expected[] = array('file' => '//external.host/js/script2.js', 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("external file - schemaless", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('//external.host/js/script.js')); - $handler->loadFile(array('///external.host/js/script.js')); - - $expected[] = array('file' => '//external.host/js/script.js', 'targetie' => null); - $this->assertEquals($handler->getJsFileList(), $expected); - }); - - $this->specify("target IE(css)", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/css/common.css', null, 'ie6')); - $handler->loadFile(array('./common/css/common.css', null, 'ie7')); - $handler->loadFile(array('./common/css/common.css', null, 'ie8')); - - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => 'ie6'); - $expected[] = array('file' => '/xe/common/css/common.css','media'=>'all', 'targetie' => 'ie7'); - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => 'ie8'); - $this->assertEquals($handler->getCssFileList(), $expected); - }); - - $this->specify("media", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('./common/css/common.css', 'all')); - $handler->loadFile(array('./common/css/common.css', 'screen')); - $handler->loadFile(array('./common/css/common.css', 'handled')); - - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => null); - $expected[] = array('file' => '/xe/common/css/common.css','media'=>'screen', 'targetie' => null); - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'handled', 'targetie' => null); - $this->assertEquals($handler->getCssFileList(), $expected); - }); - - $this->specify("external file", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('http://external.host/css/style1.css')); - $handler->loadFile(array('https://external.host/css/style2.css')); - - $expected[] = array('file' => 'http://external.host/css/style1.css', 'media'=>'all', 'targetie' => null); - $expected[] = array('file' => 'https://external.host/css/style2.css', 'media'=>'all', 'targetie' => null); - $this->assertEquals($handler->getCssFileList(), $expected); - }); - - $this->specify("external file - schemaless", function() { - $handler = new FrontEndFileHandler(); - $handler->loadFile(array('//external.host/css/style.css')); - $handler->loadFile(array('///external.host/css2/style2.css')); - - $expected[] = array('file' => '//external.host/css/style.css', 'media'=>'all', 'targetie' => null); - $expected[] = array('file' => '//external.host/css2/style2.css', 'media'=>'all', 'targetie' => null); - $this->assertEquals($handler->getCssFileList(), $expected); - }); + // target IE(js) + $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie6')); + $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie7')); + $handler->loadFile(array('./common/js/jquery.js', 'head', 'ie8')); + + if(__DEBUG__ || !__XE_VERSION_STABLE__) + { + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie6'); + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie7'); + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.js'), 'targetie' => 'ie8'); + } + else + { + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie6'); + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie7'); + $expected[] = array('file' => '/xe/common/js/jquery.min.js' . $this->_filemtime('common/js/jquery.min.js'), 'targetie' => 'ie8'); + } + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler008() + { + $handler = new FrontEndFileHandler(); + + + // external file - schemaless + $handler->loadFile(array('http://external.host/js/script.js')); + $handler->loadFile(array('https://external.host/js/script.js')); + $handler->loadFile(array('//external.host/js/script1.js')); + $handler->loadFile(array('///external.host/js/script2.js')); + + $expected[] = array('file' => 'http://external.host/js/script.js', 'targetie' => null); + $expected[] = array('file' => 'https://external.host/js/script.js', 'targetie' => null); + $expected[] = array('file' => '//external.host/js/script1.js', 'targetie' => null); + $expected[] = array('file' => '//external.host/js/script2.js', 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler009() + { + $handler = new FrontEndFileHandler(); + + // external file - schemaless + $handler->loadFile(array('//external.host/js/script.js')); + $handler->loadFile(array('///external.host/js/script.js')); + + $expected[] = array('file' => '//external.host/js/script.js', 'targetie' => null); + $this->assertEquals($handler->getJsFileList(), $expected); + } + + public function testFrontEndFileHandler010() + { + $handler = new FrontEndFileHandler(); + + // target IE(css) + $handler->loadFile(array('./common/css/common.css', null, 'ie6')); + $handler->loadFile(array('./common/css/common.css', null, 'ie7')); + $handler->loadFile(array('./common/css/common.css', null, 'ie8')); + + $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => 'ie6'); + $expected[] = array('file' => '/xe/common/css/common.css','media'=>'all', 'targetie' => 'ie7'); + $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => 'ie8'); + $this->assertEquals($handler->getCssFileList(), $expected); + } + + public function testFrontEndFileHandler011() + { + $handler = new FrontEndFileHandler(); + + // media + $handler->loadFile(array('./common/css/common.css', 'all')); + $handler->loadFile(array('./common/css/common.css', 'screen')); + $handler->loadFile(array('./common/css/common.css', 'handled')); + + $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => null); + $expected[] = array('file' => '/xe/common/css/common.css','media'=>'screen', 'targetie' => null); + $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'handled', 'targetie' => null); + $this->assertEquals($handler->getCssFileList(), $expected); + } + + public function testFrontEndFileHandler012() + { + $handler = new FrontEndFileHandler(); + + // external file + $handler->loadFile(array('http://external.host/css/style1.css')); + $handler->loadFile(array('https://external.host/css/style2.css')); + + $expected[] = array('file' => 'http://external.host/css/style1.css', 'media'=>'all', 'targetie' => null); + $expected[] = array('file' => 'https://external.host/css/style2.css', 'media'=>'all', 'targetie' => null); + $this->assertEquals($handler->getCssFileList(), $expected); + } + + public function testFrontEndFileHandler013() + { + $handler = new FrontEndFileHandler(); + // external file - schemaless + $handler->loadFile(array('//external.host/css/style.css')); + $handler->loadFile(array('///external.host/css2/style2.css')); + $expected[] = array('file' => '//external.host/css/style.css', 'media'=>'all', 'targetie' => null); + $expected[] = array('file' => '//external.host/css2/style2.css', 'media'=>'all', 'targetie' => null); + $this->assertEquals($handler->getCssFileList(), $expected); } } diff --git a/tests/unit/classes/template/TemplateHandlerTest.php b/tests/unit/classes/template/TemplateHandlerTest.php index daece9612d..d4864a6dd1 100644 --- a/tests/unit/classes/template/TemplateHandlerTest.php +++ b/tests/unit/classes/template/TemplateHandlerTest.php @@ -1,7 +1,6 @@