diff --git a/.travis.yml b/.travis.yml index c2eef4e9c..2b1d69d34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,10 @@ php: - 5.6 - hhvm before_script: + - travis_retry composer self-update - npm install -g grunt-cli - npm install + - if [ $(phpenv version-name) != "5.3" ]; then composer install; fi script: - grunt lint + - if [ $(phpenv version-name) != "5.3" ]; then ./vendor/bin/codecept run; fi diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index af6f2f01d..4a68816d8 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -166,7 +166,7 @@ class DB * leve of transaction * @var unknown */ - private $transationNestedLevel = 0; + private $transactionNestedLevel = 0; /** * returns instance of certain db type @@ -314,11 +314,6 @@ class DB { $db_type = $supported_list[$i]; - if(version_compare(phpversion(), '5.0') < 0 && preg_match('/pdo/i', $db_type)) - { - continue; - } - $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); if(!file_exists($class_file)) @@ -1142,10 +1137,10 @@ class DB return; } - if($this->_begin($this->transationNestedLevel)) + if($this->_begin($this->transactionNestedLevel)) { $this->transaction_started = TRUE; - $this->transationNestedLevel++; + $this->transactionNestedLevel++; } } @@ -1169,11 +1164,11 @@ class DB { return; } - if($this->_rollback($this->transationNestedLevel)) + if($this->_rollback($this->transactionNestedLevel)) { - $this->transationNestedLevel--; + $this->transactionNestedLevel--; - if(!$this->transationNestedLevel) + if(!$this->transactionNestedLevel) { $this->transaction_started = FALSE; } @@ -1201,14 +1196,14 @@ class DB { return; } - if($this->transationNestedLevel == 1 && $this->_commit()) + if($this->transactionNestedLevel == 1 && $this->_commit()) { $this->transaction_started = FALSE; - $this->transationNestedLevel = 0; + $this->transactionNestedLevel = 0; } else { - $this->transationNestedLevel--; + $this->transactionNestedLevel--; } } diff --git a/classes/mail/Mail.class.php b/classes/mail/Mail.class.php index 7842db788..db8089a0c 100644 --- a/classes/mail/Mail.class.php +++ b/classes/mail/Mail.class.php @@ -1,14 +1,7 @@ */ -if(version_compare(PHP_VERSION, '5.0.0', '>=')) -{ - require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php"; -} -else -{ - require_once _XE_PATH_ . "libs/phpmailer/class.phpmailer.php"; -} +require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php"; /** * Mailing class for XpressEngine diff --git a/classes/mobile/Mobile.class.php b/classes/mobile/Mobile.class.php index 79607c26e..c38ffcf21 100644 --- a/classes/mobile/Mobile.class.php +++ b/classes/mobile/Mobile.class.php @@ -52,9 +52,7 @@ class Mobile { return $this->ismobile; } - - $db_info = Context::getDBInfo(); - if($db_info->use_mobile_view != "Y" || Context::get('full_browse') || $_COOKIE["FullBrowse"]) + if(Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"]) { return ($this->ismobile = false); } @@ -234,5 +232,10 @@ class Mobile $oMobile->ismobile = $ismobile; } + function isMobileEnabled() + { + $db_info = Context::getDBInfo(); + return ($db_info->use_mobile_view === 'Y'); + } } ?> diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 075afb838..5e315d011 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -667,7 +667,8 @@ class ModuleHandler extends Handler 'dispEditorConfigPreview' => 1, 'dispLayoutPreviewWithModule' => 1 ); - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')])) + $db_use_mobile = Mobile::isMobileEnabled(); + if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) { global $lang; $header = ''; diff --git a/classes/security/Password.class.php b/classes/security/Password.class.php index 513021e8f..436c2b6e5 100644 --- a/classes/security/Password.class.php +++ b/classes/security/Password.class.php @@ -111,7 +111,7 @@ class Password case 'pbkdf2': $iterations = pow(2, $this->getWorkFactor() + 5); - $salt = $this->createSecureSalt(12); + $salt = $this->createSecureSalt(12, 'alnum'); $hash = base64_encode($this->pbkdf2($password, $salt, 'sha256', $iterations, 24)); return 'sha256:'.sprintf('%07d', $iterations).':'.$salt.':'.$hash; diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index e4e242b3b..b2d148759 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -68,7 +68,7 @@ class TemplateHandler * @param string $tpl_file * @return void */ - private function init($tpl_path, $tpl_filename, $tpl_file = '') + protected function init($tpl_path, $tpl_filename, $tpl_file = '') { // verify arguments if(substr($tpl_path, -1) != '/') @@ -213,7 +213,7 @@ class TemplateHandler * @param string $buff template file * @return string compiled result in case of success or NULL in case of error */ - private function parse($buff = null) + protected function parse($buff = null) { if(is_null($buff)) { diff --git a/codeception.yml b/codeception.yml new file mode 100644 index 000000000..9355c638c --- /dev/null +++ b/codeception.yml @@ -0,0 +1,18 @@ +actor: Tester +paths: + tests: tests + log: tests/_output + data: tests/_data + helpers: tests/_support +settings: + bootstrap: _bootstrap.php + colors: true + memory_limit: 1024M +modules: + config: + Db: + dsn: '' + user: '' + password: '' + dump: tests/_data/dump.sql +error_level: "E_STRICTE_ALL & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED & ~E_NOTICE" diff --git a/common/js/plugins/jquery.fileupload/js/main.js b/common/js/plugins/jquery.fileupload/js/main.js index 19252eb37..eddd0bfd7 100644 --- a/common/js/plugins/jquery.fileupload/js/main.js +++ b/common/js/plugins/jquery.fileupload/js/main.js @@ -56,9 +56,25 @@ var settings = { url: request_uri.setQuery('module', 'file').setQuery('act', 'procFileUpload'), - formData: {"editor_sequence": data.editorSequence, "upload_target_srl" : data.uploadTargetSrl}, + formData: {"editor_sequence": data.editorSequence, "upload_target_srl" : data.uploadTargetSrl, "mid" : window.current_mid}, dropZone: $container, + add: function(e, data) { + var dfd = jQuery.Deferred(); + + $.each(data.files, function(index, file) { + if(self.settings.maxFileSize <= file.size) { + dfd.reject(); + alert(window.xe.msg_exceeds_limit_size); + return false; + } + dfd.resolve(); + }); + + dfd.done(function(){ + data.submit(); + }); + }, done: function(e, res) { var result = res.response().result; @@ -69,7 +85,6 @@ if(!result) return; if(result.error == 0) { - // self.done.call(self, arguments); } else { alert(result.message); } @@ -77,12 +92,6 @@ stop: function() { self.loadFilelist(); }, - drop: function(e, data) { - }, - change: function(e, data) { - }, - always: function() { - }, start: function() { self.settings.progressbarGraph.width(0); self.settings.progressStatus.show(); diff --git a/common/js/plugins/jquery.fileupload/js/main.min.js b/common/js/plugins/jquery.fileupload/js/main.min.js index 7d3feafa0..ebfbfbc7c 100644 --- a/common/js/plugins/jquery.fileupload/js/main.min.js +++ b/common/js/plugins/jquery.fileupload/js/main.min.js @@ -1 +1 @@ -!function(a){"use strict";var b={autoUpload:!0,dataType:"json",replaceFileInput:!1,dropZone:".xefu-dropzone",fileList:".xefu-list",controll:".xefu-controll",filelist:".xefu-list-files ul",filelistImages:".xefu-list-images ul",progressbar:".xefu-progressbar",progressbarGraph:".xefu-progressbar div",progressStatus:".xefu-progress-status",progressPercent:".xefu-progress-percent",actSelectedInsertContent:".xefu-act-link-selected",actSelectedDeleteFile:".xefu-act-delete-selected",actDeleteFile:".xefu-act-delete",tmplXeUploaderFileitem:'
  • {{source_filename}}{{disp_file_size}} 선택
  • ',tmplXeUploaderFileitemImage:'
  • {{source_filename}}{{disp_file_size}}
  • '},c=["fileList","actSelectedInsertContent","actSelectedDeleteFile","actDeleteFile","controll","dropZone","filelist","filelistImages","progressbar","progressbarGraph","progressPercent","progressStatus"],d=xe.createApp("XeUploader",{files:{},selected_files:{},settings:{},last_selected_file:null,editor_sequence:null,init:function(){},createInstance:function(d,e){var f=this,g=this.$container=d,h=g.data();this.editor_sequence=h.editorSequence;var i={url:request_uri.setQuery("module","file").setQuery("act","procFileUpload"),formData:{editor_sequence:h.editorSequence,upload_target_srl:h.uploadTargetSrl},dropZone:g,done:function(a,b){var c=b.response().result;c&&(jQuery.isPlainObject(c)||(c=jQuery.parseJSON(c)),c&&(0==c.error||alert(c.message)))},stop:function(){f.loadFilelist()},drop:function(){},change:function(){},always:function(){},start:function(){f.settings.progressbarGraph.width(0),f.settings.progressStatus.show(),f.settings.progressbar.show()},progressall:function(a,b){var c=parseInt(b.loaded/b.total*100,10);f.settings.progressbarGraph.width(c+"%"),f.settings.progressPercent.text(c+"%"),c>=100&&(f.settings.progressbar.delay(3e3).slideUp(),f.settings.progressStatus.delay(3e3).slideUp())}};this.settings=a.extend({},b,i,e||{}),a.each(c,function(a,b){"string"==typeof f.settings[b]&&(f.settings[b]=g.find(f.settings[b]))});g.fileupload(this.settings).prop("disabled",!a.support.fileInput).parent().addClass(a.support.fileInput?void 0:"disabled");g.data("xefu-instance",this),this.loadFilelist(),this.settings.actSelectedInsertContent.on("click",function(){f.insertToContent()}),this.settings.actSelectedDeleteFile.on("click",function(){f.deleteFile()});var j=this.settings.fileList.finderSelect({children:"li"});this.settings.fileList.on("mousedown","img",function(a){a.preventDefault()}),j.finderSelect("addHook","highlight:after",function(a){a.find("input").prop("checked",!0);var b=f.settings.fileList.find("input:checked");f.selected_files=b}),j.finderSelect("addHook","unHighlight:after",function(a){a.find("input").prop("checked",!1);var b=f.settings.fileList.find("input:checked");f.selected_files=b}),j.on("click",":checkbox",function(a){a.preventDefault()}),a(document).bind("dragover",function(a){var b=window.dropZoneTimeout;b?clearTimeout(b):f.settings.dropZone.addClass("in");var c=!1,d=a.target;do{if(d===dropZone[0]){c=!0;break}d=d.parentNode}while(null!=d);c?f.settings.dropZone.addClass("hover"):f.settings.dropZone.removeClass("hover"),window.dropZoneTimeout=setTimeout(function(){window.dropZoneTimeout=null,f.settings.dropZone.removeClass("in hover")},100)})},done:function(){},selectAllFiles:function(){},selectImageFiles:function(){},selectNonImageFiles:function(){},unselectAllFiles:function(){},unselectImageFiles:function(){},unselectNonImageFiles:function(){},insertToContent:function(){var b=this,c="";a.each(this.selected_files,function(d,e){var f=a(e).data().fileSrl,g=b.files[f];g&&(/\.(jpe?g|png|gif)$/i.test(g.download_url)?(c+=''+g.source_filename+'',c+="\r\n


    \r\n"):c+=''+g.source_filename+"\n")}),_getCkeInstance(this.editor_sequence).insertHtml(c,"unfiltered_html")},deleteFile:function(b){var c=this,d=[];b?d.push(b):a.each(c.selected_files,function(b,c){if(c){var e=a(c).data().fileSrl;d.push(e)}}),d=d.join(","),exec_json("file.procFileDelete",{file_srls:d,editor_sequence:this.editor_sequence},function(){d=d.split(","),a.each(d,function(a,b){c.settings.fileList.find("ul").find("li[data-file-srl="+b+"]").remove()}),c.loadFilelist()})},loadFilelist:function(){var b=this,c=this.$container.data();a.exec_json("file.getFileList",{editor_sequence:b.$container.data("editor-sequence")},function(d){c.uploadTargetSrl=d.upload_target_srl,editorRelKeys[b.$container.data("editor-sequence")].primary.value=d.upload_target_srl,c.uploadTargetSrl=d.uploadTargetSrl,a(".allowed_filetypes").text(d.allowed_filetypes),a(".allowed_filesize").text(d.allowed_filesize),a(".allowed_attach_size").text(d.allowed_attach_size),a(".attached_size").text(d.attached_size),a(".file_count").text(d.files.length);var e=b.settings.tmplXeUploaderFileitem,f=b.settings.tmplXeUploaderFileitemImage,g=Handlebars.compile(e),h=Handlebars.compile(f),i=[],j=[];return d.files.length?(a.each(d.files,function(a,c){b.files[c.file_srl]||(b.files[c.file_srl]=c,/\.(jpe?g|png|gif)$/i.test(c.source_filename)?i.push(h(c)):j.push(g(c)))}),b.settings.filelistImages.append(i.join("")),b.settings.filelist.append(j.join("")),b.settings.controll.show(),void b.settings.fileList.show()):(b.settings.fileList.hide(),void b.settings.controll.hide())})}});a.fn.xeUploader=function(a){var b=new d;return b&&(xe.registerApp(b),b.createInstance(this.eq(0),a)),b}}(jQuery); \ No newline at end of file +!function(a){"use strict";var b={autoUpload:!0,dataType:"json",replaceFileInput:!1,dropZone:".xefu-dropzone",fileList:".xefu-list",controll:".xefu-controll",filelist:".xefu-list-files ul",filelistImages:".xefu-list-images ul",progressbar:".xefu-progressbar",progressbarGraph:".xefu-progressbar div",progressStatus:".xefu-progress-status",progressPercent:".xefu-progress-percent",actSelectedInsertContent:".xefu-act-link-selected",actSelectedDeleteFile:".xefu-act-delete-selected",actDeleteFile:".xefu-act-delete",tmplXeUploaderFileitem:'
  • {{source_filename}}{{disp_file_size}} 선택
  • ',tmplXeUploaderFileitemImage:'
  • {{source_filename}}{{disp_file_size}}
  • '},c=["fileList","actSelectedInsertContent","actSelectedDeleteFile","actDeleteFile","controll","dropZone","filelist","filelistImages","progressbar","progressbarGraph","progressPercent","progressStatus"],d=xe.createApp("XeUploader",{files:{},selected_files:{},settings:{},last_selected_file:null,editor_sequence:null,init:function(){},createInstance:function(d,e){var f=this,g=this.$container=d,h=g.data();this.editor_sequence=h.editorSequence;var i={url:request_uri.setQuery("module","file").setQuery("act","procFileUpload"),formData:{editor_sequence:h.editorSequence,upload_target_srl:h.uploadTargetSrl,mid:window.current_mid},dropZone:g,add:function(b,c){var d=jQuery.Deferred();a.each(c.files,function(a,b){return f.settings.maxFileSize<=b.size?(d.reject(),alert(window.xe.msg_exceeds_limit_size),!1):void d.resolve()}),d.done(function(){c.submit()})},done:function(a,b){var c=b.response().result;c&&(jQuery.isPlainObject(c)||(c=jQuery.parseJSON(c)),c&&(0==c.error||alert(c.message)))},stop:function(){f.loadFilelist()},start:function(){f.settings.progressbarGraph.width(0),f.settings.progressStatus.show(),f.settings.progressbar.show()},progressall:function(a,b){var c=parseInt(b.loaded/b.total*100,10);f.settings.progressbarGraph.width(c+"%"),f.settings.progressPercent.text(c+"%"),c>=100&&(f.settings.progressbar.delay(3e3).slideUp(),f.settings.progressStatus.delay(3e3).slideUp())}};this.settings=a.extend({},b,i,e||{}),a.each(c,function(a,b){"string"==typeof f.settings[b]&&(f.settings[b]=g.find(f.settings[b]))});g.fileupload(this.settings).prop("disabled",!a.support.fileInput).parent().addClass(a.support.fileInput?void 0:"disabled");g.data("xefu-instance",this),this.loadFilelist(),this.settings.actSelectedInsertContent.on("click",function(){f.insertToContent()}),this.settings.actSelectedDeleteFile.on("click",function(){f.deleteFile()});var j=this.settings.fileList.finderSelect({children:"li"});this.settings.fileList.on("mousedown","img",function(a){a.preventDefault()}),j.finderSelect("addHook","highlight:after",function(a){a.find("input").prop("checked",!0);var b=f.settings.fileList.find("input:checked");f.selected_files=b}),j.finderSelect("addHook","unHighlight:after",function(a){a.find("input").prop("checked",!1);var b=f.settings.fileList.find("input:checked");f.selected_files=b}),j.on("click",":checkbox",function(a){a.preventDefault()}),a(document).bind("dragover",function(a){var b=window.dropZoneTimeout;b?clearTimeout(b):f.settings.dropZone.addClass("in");var c=!1,d=a.target;do{if(d===dropZone[0]){c=!0;break}d=d.parentNode}while(null!=d);c?f.settings.dropZone.addClass("hover"):f.settings.dropZone.removeClass("hover"),window.dropZoneTimeout=setTimeout(function(){window.dropZoneTimeout=null,f.settings.dropZone.removeClass("in hover")},100)})},done:function(){},selectAllFiles:function(){},selectImageFiles:function(){},selectNonImageFiles:function(){},unselectAllFiles:function(){},unselectImageFiles:function(){},unselectNonImageFiles:function(){},insertToContent:function(){var b=this,c="";a.each(this.selected_files,function(d,e){var f=a(e).data().fileSrl,g=b.files[f];g&&(/\.(jpe?g|png|gif)$/i.test(g.download_url)?(c+=''+g.source_filename+'',c+="\r\n


    \r\n"):c+=''+g.source_filename+"\n")}),_getCkeInstance(this.editor_sequence).insertHtml(c,"unfiltered_html")},deleteFile:function(b){var c=this,d=[];b?d.push(b):a.each(c.selected_files,function(b,c){if(c){var e=a(c).data().fileSrl;d.push(e)}}),d=d.join(","),exec_json("file.procFileDelete",{file_srls:d,editor_sequence:this.editor_sequence},function(){d=d.split(","),a.each(d,function(a,b){c.settings.fileList.find("ul").find("li[data-file-srl="+b+"]").remove()}),c.loadFilelist()})},loadFilelist:function(){var b=this,c=this.$container.data();a.exec_json("file.getFileList",{editor_sequence:b.$container.data("editor-sequence")},function(d){c.uploadTargetSrl=d.upload_target_srl,editorRelKeys[b.$container.data("editor-sequence")].primary.value=d.upload_target_srl,c.uploadTargetSrl=d.uploadTargetSrl,a(".allowed_filetypes").text(d.allowed_filetypes),a(".allowed_filesize").text(d.allowed_filesize),a(".allowed_attach_size").text(d.allowed_attach_size),a(".attached_size").text(d.attached_size),a(".file_count").text(d.files.length);var e=b.settings.tmplXeUploaderFileitem,f=b.settings.tmplXeUploaderFileitemImage,g=Handlebars.compile(e),h=Handlebars.compile(f),i=[],j=[];return d.files.length?(a.each(d.files,function(a,c){b.files[c.file_srl]||(b.files[c.file_srl]=c,/\.(jpe?g|png|gif)$/i.test(c.source_filename)?i.push(h(c)):j.push(g(c)))}),b.settings.filelistImages.append(i.join("")),b.settings.filelist.append(j.join("")),b.settings.controll.show(),void b.settings.fileList.show()):(b.settings.fileList.hide(),void b.settings.controll.hide())})}});a.fn.xeUploader=function(a){var b=new d;return b&&(xe.registerApp(b),b.createInstance(this.eq(0),a)),b}}(jQuery); \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..db7528358 --- /dev/null +++ b/composer.json @@ -0,0 +1,17 @@ +{ + "name": "xpressengine/xe-core", + "license": "GNU LGPL", + "authors": [ + { + "name": "NAVER", + "email": "developers@xpressengine.com" + } + ], + "require": { + }, + "require-dev": { + "codeception/codeception": "~2.0", + "codeception/verify": "0.2.*", + "codeception/specify": "0.4.*" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..23c595a15 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1741 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "0b13ef2987c06113ab0a920cdb9e4e83", + "packages": [], + "packages-dev": [ + { + "name": "codeception/codeception", + "version": "2.0.12", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Codeception.git", + "reference": "6e29668921182d6b90cd021033002be85382c6f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/6e29668921182d6b90cd021033002be85382c6f9", + "reference": "6e29668921182d6b90cd021033002be85382c6f9", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facebook/webdriver": "~0.4|~0.5", + "guzzlehttp/guzzle": "~4.0|~5.0", + "php": ">=5.4.0", + "phpunit/phpunit": "~4.5.0", + "symfony/browser-kit": "~2.4", + "symfony/console": "~2.4", + "symfony/css-selector": "~2.4", + "symfony/dom-crawler": "~2.4,!=2.4.5", + "symfony/event-dispatcher": "~2.4", + "symfony/finder": "~2.4", + "symfony/yaml": "~2.4" + }, + "require-dev": { + "codeception/specify": "~0.3", + "facebook/php-sdk": "~3.2", + "flow/jsonpath": "~0.2", + "monolog/monolog": "~1.8", + "pda/pheanstalk": "~2.0", + "videlalvaro/php-amqplib": "~2.4" + }, + "suggest": { + "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", + "codeception/specify": "BDD-style code blocks", + "codeception/verify": "BDD-style assertions", + "monolog/monolog": "Log test steps", + "phpseclib/phpseclib": "Extension required to use the SFTP option in the FTP Module." + }, + "bin": [ + "codecept" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "psr-0": { + "Codeception": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert@mail.ua", + "homepage": "http://codegyre.com" + } + ], + "description": "BDD-style testing framework", + "homepage": "http://codeception.com/", + "keywords": [ + "BDD", + "TDD", + "acceptance testing", + "functional testing", + "unit testing" + ], + "time": "2015-04-02 23:50:20" + }, + { + "name": "codeception/specify", + "version": "0.4.1", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Specify.git", + "reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Specify/zipball/0c0ae07adfc231115b3b72ade22f44c23c199ded", + "reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded", + "shasum": "" + }, + "require": { + "myclabs/deep-copy": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Codeception\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert.php@mailican.com" + } + ], + "description": "BDD code blocks for PHPUnit and Codeception", + "time": "2014-10-17 00:06:51" + }, + { + "name": "codeception/verify", + "version": "0.2.7", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Verify.git", + "reference": "66e5074905f4d9590ddb805d123fe632f4baa488" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Verify/zipball/66e5074905f4d9590ddb805d123fe632f4baa488", + "reference": "66e5074905f4d9590ddb805d123fe632f4baa488", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "files": [ + "src/Codeception/function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert.php@mailican.com", + "homepage": "http://codeception.com" + } + ], + "description": "BDD assertion library for PHPUnit", + "time": "2014-01-22 14:40:33" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Instantiator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2014-10-13 12:58:55" + }, + { + "name": "facebook/webdriver", + "version": "v0.5.1", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/bbcb697efb394d17bd9ec3d467e7da847cde4509", + "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509", + "shasum": "" + }, + "require": { + "php": ">=5.3.19" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "2.*", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A php client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2014-11-05 20:53:09" + }, + { + "name": "guzzlehttp/guzzle", + "version": "5.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "475b29ccd411f2fa8a408e64576418728c032cfa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa", + "reference": "475b29ccd411f2fa8a408e64576418728c032cfa", + "shasum": "" + }, + "require": { + "guzzlehttp/ringphp": "~1.0", + "php": ">=5.4.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2015-01-28 01:03:29" + }, + { + "name": "guzzlehttp/ringphp", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/guzzle/RingPHP.git", + "reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2", + "reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2", + "shasum": "" + }, + "require": { + "guzzlehttp/streams": "~3.0", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "time": "2015-03-30 01:43:20" + }, + { + "name": "guzzlehttp/streams", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-10-12 19:18:40" + }, + { + "name": "myclabs/deep-copy", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "96fbdc07635989c35c5a1912379f4c4b2ab15fd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/96fbdc07635989c35c5a1912379f4c4b2ab15fd5", + "reference": "96fbdc07635989c35c5a1912379f4c4b2ab15fd5", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2015-03-21 22:40:23" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", + "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-03-27 19:31:25" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.0.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "34cc484af1ca149188d0d9e91412191e398e0b67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67", + "reference": "34cc484af1ca149188d0d9e91412191e398e0b67", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "~1.0", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-01-24 10:06:35" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2013-10-10 15:34:57" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2014-01-30 17:20:04" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74", + "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-01-17 09:51:32" + }, + { + "name": "phpunit/phpunit", + "version": "4.5.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "~1.3,>=1.3.1", + "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "phpunit/php-file-iterator": "~1.3.2", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.2", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-03-29 09:24:05" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "74ffb87f527f24616f72460e54b595f508dccb5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/74ffb87f527f24616f72460e54b595f508dccb5c", + "reference": "74ffb87f527f24616f72460e54b595f508dccb5c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "~1.0,>=1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-04-02 05:36:41" + }, + { + "name": "react/promise", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef", + "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@googlemail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "time": "2014-12-30 13:32:42" + }, + { + "name": "sebastian/comparator", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-01-29 16:28:08" + }, + { + "name": "sebastian/diff", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "http://www.github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-02-22 15:13:53" + }, + { + "name": "sebastian/environment", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-01-01 10:01:08" + }, + { + "name": "sebastian/exporter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "84839970d05254c73cde183a721c7af13aede943" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", + "reference": "84839970d05254c73cde183a721c7af13aede943", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-01-27 07:23:06" + }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-01-24 09:48:32" + }, + { + "name": "sebastian/version", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-02-24 06:35:25" + }, + { + "name": "symfony/browser-kit", + "version": "v2.6.6", + "target-dir": "Symfony/Component/BrowserKit", + "source": { + "type": "git", + "url": "https://github.com/symfony/BrowserKit.git", + "reference": "f21189b0eccbe56528515858ca1d5089a741692f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/f21189b0eccbe56528515858ca1d5089a741692f", + "reference": "f21189b0eccbe56528515858ca1d5089a741692f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/dom-crawler": "~2.0,>=2.0.5" + }, + "require-dev": { + "symfony/css-selector": "~2.0,>=2.0.5", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.0,>=2.0.5" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\BrowserKit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + }, + { + "name": "symfony/console", + "version": "v2.6.6", + "target-dir": "Symfony/Component/Console", + "source": { + "type": "git", + "url": "https://github.com/symfony/Console.git", + "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Console/zipball/5b91dc4ed5eb08553f57f6df04c4730a73992667", + "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Console Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + }, + { + "name": "symfony/css-selector", + "version": "v2.6.6", + "target-dir": "Symfony/Component/CssSelector", + "source": { + "type": "git", + "url": "https://github.com/symfony/CssSelector.git", + "reference": "db2c48df9658423a8c168d89f7b971b73d3d74a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/db2c48df9658423a8c168d89f7b971b73d3d74a4", + "reference": "db2c48df9658423a8c168d89f7b971b73d3d74a4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\CssSelector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "http://symfony.com", + "time": "2015-03-22 16:55:57" + }, + { + "name": "symfony/dom-crawler", + "version": "v2.6.6", + "target-dir": "Symfony/Component/DomCrawler", + "source": { + "type": "git", + "url": "https://github.com/symfony/DomCrawler.git", + "reference": "8897ebf39c7dfb752a5494fa301845a3fbb9e53d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/8897ebf39c7dfb752a5494fa301845a3fbb9e53d", + "reference": "8897ebf39c7dfb752a5494fa301845a3fbb9e53d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/css-selector": "~2.3", + "symfony/phpunit-bridge": "~2.7" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DomCrawler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.6.6", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284", + "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com", + "time": "2015-03-13 17:37:22" + }, + { + "name": "symfony/finder", + "version": "v2.6.6", + "target-dir": "Symfony/Component/Finder", + "source": { + "type": "git", + "url": "https://github.com/symfony/Finder.git", + "reference": "5dbe2e73a580618f5b4880fda93406eed25de251" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Finder/zipball/5dbe2e73a580618f5b4880fda93406eed25de251", + "reference": "5dbe2e73a580618f5b4880fda93406eed25de251", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Finder\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Finder Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + }, + { + "name": "symfony/yaml", + "version": "v2.6.6", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "174f009ed36379a801109955fc5a71a49fe62dd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4", + "reference": "174f009ed36379a801109955fc5a71a49fe62dd4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/config/config.inc.php b/config/config.inc.php index 3fadda2c5..8fd8a1eff 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -29,7 +29,7 @@ define('__ZBXE__', __XE__); /** * Display XE's full version. */ -define('__XE_VERSION__', '1.8.0'); +define('__XE_VERSION__', '1.8.1'); define('__XE_VERSION_ALPHA__', (stripos(__XE_VERSION__, 'alpha') !== false)); define('__XE_VERSION_BETA__', (stripos(__XE_VERSION__, 'beta') !== false)); define('__XE_VERSION_RC__', (stripos(__XE_VERSION__, 'rc') !== false)); diff --git a/layouts/xedition/layout.html b/layouts/xedition/layout.html index 51d747b5a..792def202 100644 --- a/layouts/xedition/layout.html +++ b/layouts/xedition/layout.html @@ -297,13 +297,6 @@ -
    -
    -
    - 설정되지 않음 -
    -
    -
    diff --git a/modules/editor/skins/ckeditor/file_upload.html b/modules/editor/skins/ckeditor/file_upload.html index e7aef9149..59c28b638 100644 --- a/modules/editor/skins/ckeditor/file_upload.html +++ b/modules/editor/skins/ckeditor/file_upload.html @@ -55,7 +55,12 @@ limitMultiFileUploadSize: {$file_config->allowed_filesize} }; var uploader = $('#xefu-container-{$editor_sequence}').xeUploader(setting); - // console.log(uploader); + window.xe.msg_exceeds_limit_size = '{$lang->msg_exceeds_limit_size}'; + window.xe.msg_checked_file_is_deleted = '{$lang->msg_checked_file_is_deleted}'; + window.xe.msg_file_cart_is_null = '{$lang->msg_file_cart_is_null}'; + window.xe.msg_checked_file_is_deleted = '{$lang->msg_checked_file_is_deleted}'; + window.xe.msg_not_allowed_filetype = '{$lang->msg_not_allowed_filetype}'; + window.xe.msg_file_upload_error = '{$lang->msg_file_upload_error}'; }); diff --git a/modules/editor/tpl/js/editor.app.js b/modules/editor/tpl/js/editor.app.js index 678434865..9542619ed 100644 --- a/modules/editor/tpl/js/editor.app.js +++ b/modules/editor/tpl/js/editor.app.js @@ -65,6 +65,8 @@ this.editor_sequence = data.editorSequence; $form.attr('editor_sequence', data.editorSequence); + + if(CKEDITOR.env.mobile) CKEDITOR.env.isCompatible = true; var instance = CKEDITOR.appendTo($containerEl[0], {}, $contentField.val()); diff --git a/modules/editor/tpl/js/editor.app.min.js b/modules/editor/tpl/js/editor.app.min.js index e096b79c2..c11157caa 100644 --- a/modules/editor/tpl/js/editor.app.min.js +++ b/modules/editor/tpl/js/editor.app.min.js @@ -1 +1 @@ -!function(a){"use strict";function b(b){return a.grep(b,function(c,d){return c.length&&a.inArray(c,b)===d})}var c={bodyClass:"xe_content editable",toolbarCanCollapse:!0,toolbarGroups:[{name:"clipboard",groups:["undo","clipboard"]},{name:"editing",groups:["find","selection"]},{name:"links"},{name:"insert"},{name:"tools"},{name:"document",groups:["mode"]},"/",{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},"/",{name:"styles"},{name:"colors"},{name:"xecomponent"},{name:"others"}],allowedContent:!0,removePlugins:"stylescombo,language,bidi,flash,pagebreak",removeButtons:"Save,Preview,Print,Cut,Copy,Paste",uiColor:"#EFF0F0"},d=xe.createApp("XeCkEditor",{ckeconfig:{},editor_sequence:null,init:function(){var a=this;CKEDITOR.on("instanceCreated",function(){a.cast("CKEDITOR_CREATED")}),CKEDITOR.on("ready",function(){a.cast("CKEDITOR_READY")}),CKEDITOR.on("instanceReady",function(){a.cast("CKEDITOR_INSTANCE_READY")}),CKEDITOR.on("instanceLoaded",function(){a.cast("CKEDITOR_LOADED")})},editorInit:function(d,e){{var f=this,g=d,h=g.closest("form"),i=e.content_field,j=g.data();g.data().editorSequence}this.ckeconfig=a.extend({},c,e.ckeconfig||{}),this.editor_sequence=j.editorSequence,h.attr("editor_sequence",j.editorSequence);var k=CKEDITOR.appendTo(g[0],{},i.val());k.on("customConfigLoaded",function(d){if(k.config=a.extend({},d.editor.config,f.ckeconfig),a.isFunction(CKEDITOR.editorConfig)){var g={};CKEDITOR.editorConfig(g),a.each(g,function(a,b){k.config[a]=b})}var h=d.editor.config.bodyClass.split(" ");if(h.push(c.bodyClass),h=b(h),k.config.bodyClass=h.join(" "),e.loadXeComponent){var i=d.editor.config.extraPlugins.split(",");i.push("xe_component"),i=b(i),k.config.extraPlugins=i.join(",")}e.enableToolbar||(k.config.toolbar=[])}),g.data("cke_instance",k),window.editorRelKeys[j.editorSequence]={},window.editorRelKeys[j.editorSequence].primary=h.find("[name="+j.editorPrimaryKeyName+"]")[0],window.editorRelKeys[j.editorSequence].content=h.find("[name="+j.editorContentKeyName+"]")[0],window.editorRelKeys[j.editorSequence].func=function(a){return f.getContent.call(f,a)},window.editorRelKeys[j.editorSequence].pasteHTML=function(a){k.insertHtml(a,"html")}},getContent:function(a){var b=this,c=_getCkeInstance(a).getData();return b.cast("GET_CONTENT",[c]),c},getInstance:function(a){return CKEDITOR.instances[a]},API_EDITOR_CREATED:function(){}});a.fn.XeCkEditor=function(a){var b=new d(this.eq(0),a);return b&&(xe.registerApp(b),b.editorInit(this.eq(0),a)),b},window.xe.XeCkEditor=function(){var a=new d;return a}}(jQuery); \ No newline at end of file +!function(a){"use strict";function b(b){return a.grep(b,function(c,d){return c.length&&a.inArray(c,b)===d})}var c={bodyClass:"xe_content editable",toolbarCanCollapse:!0,toolbarGroups:[{name:"clipboard",groups:["undo","clipboard"]},{name:"editing",groups:["find","selection"]},{name:"links"},{name:"insert"},{name:"tools"},{name:"document",groups:["mode"]},"/",{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},"/",{name:"styles"},{name:"colors"},{name:"xecomponent"},{name:"others"}],allowedContent:!0,removePlugins:"stylescombo,language,bidi,flash,pagebreak",removeButtons:"Save,Preview,Print,Cut,Copy,Paste",uiColor:"#EFF0F0"},d=xe.createApp("XeCkEditor",{ckeconfig:{},editor_sequence:null,init:function(){var a=this;CKEDITOR.on("instanceCreated",function(){a.cast("CKEDITOR_CREATED")}),CKEDITOR.on("ready",function(){a.cast("CKEDITOR_READY")}),CKEDITOR.on("instanceReady",function(){a.cast("CKEDITOR_INSTANCE_READY")}),CKEDITOR.on("instanceLoaded",function(){a.cast("CKEDITOR_LOADED")})},editorInit:function(d,e){{var f=this,g=d,h=g.closest("form"),i=e.content_field,j=g.data();g.data().editorSequence}this.ckeconfig=a.extend({},c,e.ckeconfig||{}),this.editor_sequence=j.editorSequence,h.attr("editor_sequence",j.editorSequence),CKEDITOR.env.mobile&&(CKEDITOR.env.isCompatible=!0);var k=CKEDITOR.appendTo(g[0],{},i.val());k.on("customConfigLoaded",function(d){if(k.config=a.extend({},d.editor.config,f.ckeconfig),a.isFunction(CKEDITOR.editorConfig)){var g={};CKEDITOR.editorConfig(g),a.each(g,function(a,b){k.config[a]=b})}var h=d.editor.config.bodyClass.split(" ");if(h.push(c.bodyClass),h=b(h),k.config.bodyClass=h.join(" "),e.loadXeComponent){var i=d.editor.config.extraPlugins.split(",");i.push("xe_component"),i=b(i),k.config.extraPlugins=i.join(",")}e.enableToolbar||(k.config.toolbar=[])}),g.data("cke_instance",k),window.editorRelKeys[j.editorSequence]={},window.editorRelKeys[j.editorSequence].primary=h.find("[name="+j.editorPrimaryKeyName+"]")[0],window.editorRelKeys[j.editorSequence].content=h.find("[name="+j.editorContentKeyName+"]")[0],window.editorRelKeys[j.editorSequence].func=function(a){return f.getContent.call(f,a)},window.editorRelKeys[j.editorSequence].pasteHTML=function(a){k.insertHtml(a,"html")}},getContent:function(a){var b=this,c=_getCkeInstance(a).getData();return b.cast("GET_CONTENT",[c]),c},getInstance:function(a){return CKEDITOR.instances[a]},API_EDITOR_CREATED:function(){}});a.fn.XeCkEditor=function(a){var b=new d(this.eq(0),a);return b&&(xe.registerApp(b),b.editorInit(this.eq(0),a)),b},window.xe.XeCkEditor=function(){var a=new d;return a}}(jQuery); \ No newline at end of file diff --git a/modules/install/script/ko.install.php b/modules/install/script/ko.install.php index a1b98708e..92ba4cbb6 100644 --- a/modules/install/script/ko.install.php +++ b/modules/install/script/ko.install.php @@ -22,24 +22,24 @@ $sitemap = array( 'module_id' => 'board', 'list' => array( array( - 'menu_name' => 'SMAPLE 1', + 'menu_name' => 'SAMPLE 1', 'is_shortcut' => 'Y', 'shortcut_target' => '#', 'list' => array( array( - 'menu_name' => 'SMAPLE 1-1', + 'menu_name' => 'SAMPLE 1-1', 'is_shortcut' => 'Y', 'shortcut_target' => '#' ), ) ), array( - 'menu_name' => 'SMAPLE 2', + 'menu_name' => 'SAMPLE 2', 'is_shortcut' => 'Y', 'shortcut_target' => '#' ), array( - 'menu_name' => 'SMAPLE 3', + 'menu_name' => 'SAMPLE 3', 'is_shortcut' => 'Y', 'shortcut_target' => '#' ), @@ -175,16 +175,12 @@ foreach($sitemap as $id => &$val) $oMenuAdminController->makeHomemenuCacheFile($val['menu_srl']); } - - // create Layout //extra_vars init $extra_vars = new stdClass(); $extra_vars->GNB = $sitemap['GNB']['menu_srl']; -$extra_vars->UNB = $simtemap['UNB']['menu_srl']; -$extra_vars->FNB = $simtemap['FNB']['menu_srl']; -$extra_vars->menu_name_list = array(); -$extra_vars->menu_name_list[$sitemap['GNB']['menu_srl']] = 'Welcome menu'; +$extra_vars->UNB = $sitemap['UNB']['menu_srl']; +$extra_vars->FNB = $sitemap['FNB']['menu_srl']; $args = new stdClass(); $layout_srl = $args->layout_srl = getNextSequence(); diff --git a/modules/member/queries/chkAuthMail.xml b/modules/member/queries/chkAuthMail.xml index 9505632a9..34911c35f 100644 --- a/modules/member/queries/chkAuthMail.xml +++ b/modules/member/queries/chkAuthMail.xml @@ -1,4 +1,4 @@ - + diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 960f0f584..c468d8cb7 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -606,8 +606,7 @@ class menuAdminController extends menu $cmArgs->is_skin_fix = 'N'; $cmArgs->is_mskin_fix = 'N'; - $db_info = Context::getDBInfo(); - if($db_info->use_mobile_view == 'Y') + if(Mobile::isMobileEnabled() === true) { $cmArgs->use_mobile = 'Y'; } diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php deleted file mode 100644 index 28119bdb3..000000000 --- a/tests/Bootstrap.php +++ /dev/null @@ -1,26 +0,0 @@ - */ - -if(!defined('__DEBUG__')) define('__DEBUG__', 1); -if(!defined('__XE__')) define('__XE__', true); -if(!defined('__ZBXE__')) define('__ZBXE__', true); -if(!defined('_XE_PATH_')) define('_XE_PATH_', realpath(dirname(__FILE__).'/../').'/'); - -$_SERVER['SCRIPT_NAME'] = '/xe/index.php'; -error_reporting(E_ALL & ~E_NOTICE); - -/** - * Print out the message - **/ -function _log($msg) { - $args = func_get_args(); - - foreach($args as $arg) { - fwrite(STDOUT, "\n"); - fwrite(STDOUT, print_r($arg, true)); - } - fwrite(STDOUT, "\n"); -} - -/* End of file Bootstrap.php */ -/* Location: ./tests/Bootstrap.php */ diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php new file mode 100644 index 000000000..e0d603d32 --- /dev/null +++ b/tests/_bootstrap.php @@ -0,0 +1,3 @@ +setHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * ?> + * ``` + * + * @param string $name the name of the request header + * @param string $value the value to set it to for subsequent + * requests + * @see \Codeception\Module\PhpBrowser::setHeader() + */ + public function setHeader($name, $value) { + return $this->scenario->runStep(new \Codeception\Step\Action('setHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes the header with the passed name. Subsequent requests + * will not have the deleted header in its request. + * + * Example: + * ```php + * setHeader('X-Requested-With', 'Codeception'); + * $I->amOnPage('test-headers.php'); + * // ... + * $I->deleteHeader('X-Requested-With'); + * $I->amOnPage('some-other-page.php'); + * ?> + * ``` + * + * @param string $name the name of the header to delete. + * @see \Codeception\Module\PhpBrowser::deleteHeader() + */ + public function deleteHeader($name) { + return $this->scenario->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Authenticates user for HTTP_AUTH + * + * @param $username + * @param $password + * @see \Codeception\Module\PhpBrowser::amHttpAuthenticated() + */ + public function amHttpAuthenticated($username, $password) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opens the page for the given relative URI. + * + * ``` php + * amOnPage('/'); + * // opens /register page + * $I->amOnPage('/register'); + * ?> + * ``` + * + * @param $page + * @see \Codeception\Module\PhpBrowser::amOnPage() + */ + public function amOnPage($page) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Open web page at the given absolute URL and sets its hostname as the base host. + * + * ``` php + * amOnUrl('http://codeception.com'); + * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart + * ?> + * ``` + * @see \Codeception\Module\PhpBrowser::amOnUrl() + */ + public function amOnUrl($url) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Changes the subdomain for the 'url' configuration parameter. + * Does not open a page; use `amOnPage` for that. + * + * ``` php + * amOnSubdomain('user'); + * $I->amOnPage('/'); + * // moves to http://user.mysite.com/ + * ?> + * ``` + * + * @param $subdomain + * + * @return mixed + * @see \Codeception\Module\PhpBrowser::amOnSubdomain() + */ + public function amOnSubdomain($subdomain) { + return $this->scenario->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Low-level API method. + * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly + * + * Example: + * + * ``` php + * executeInGuzzle(function (\GuzzleHttp\Client $client) { + * $client->get('/get', ['query' => ['foo' => 'bar']]); + * }); + * ?> + * ``` + * + * It is not recommended to use this command on a regular basis. + * If Codeception lacks important Guzzle Client methods, implement them and submit patches. + * + * @param callable $function + * @see \Codeception\Module\PhpBrowser::executeInGuzzle() + */ + public function executeInGuzzle($function) { + return $this->scenario->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Perform a click on a link or a button, given by a locator. + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. + * For buttons, the "value" attribute, "name" attribute, and inner text are searched. + * For links, the link text is searched. + * For images, the "alt" attribute and inner text of any parent links are searched. + * + * The second parameter is a context (CSS or XPath locator) to narrow the search. + * + * Note that if the locator matches a button of type `submit`, the form will be submitted. + * + * ``` php + * click('Logout'); + * // button of form + * $I->click('Submit'); + * // CSS button + * $I->click('#form input[type=submit]'); + * // XPath + * $I->click('//form/*[@type=submit]'); + * // link in context + * $I->click('Logout', '#nav'); + * // using strict locator + * $I->click(['link' => 'Login']); + * ?> + * ``` + * + * @param $link + * @param $context + * @see \Codeception\Lib\InnerBrowser::click() + */ + public function click($link, $context = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('click', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. + * + * ``` php + * see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up','h1'); // I can suppose it's a signup page + * $I->see('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function canSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. + * + * ``` php + * see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up','h1'); // I can suppose it's a signup page + * $I->see('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::see() + */ + public function see($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('see', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```php + * dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function cantSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```php + * dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Lib\InnerBrowser::dontSee() + */ + public function dontSee($text, $selector = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeLink() + */ + public function canSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::seeLink() + */ + public function seeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function cantSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Lib\InnerBrowser::dontSeeLink() + */ + public function dontSeeLink($text, $url = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function canSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() + */ + public function seeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function cantSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() + */ + public function dontSeeInCurrentUrl($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function canSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() + */ + public function seeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function cantSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() + */ + public function dontSeeCurrentUrlEquals($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function canSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() + */ + public function seeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function cantSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() + */ + public function dontSeeCurrentUrlMatches($uri) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Executes the given regular expression against the current URI and returns the first match. + * If no parameters are provided, the full URI is returned. + * + * ``` php + * grabFromCurrentUrl('~$/user/(\d+)/~'); + * $uri = $I->grabFromCurrentUrl(); + * ?> + * ``` + * + * @param null $uri + * + * @internal param $url + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() + */ + public function grabFromCurrentUrl($uri = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` php + * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. + * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); + * ?> + * ``` + * + * @param $checkbox + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() + */ + public function canSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` php + * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. + * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); + * ?> + * ``` + * + * @param $checkbox + * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() + */ + public function seeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` php + * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. + * ?> + * ``` + * + * @param $checkbox + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() + */ + public function cantSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` php + * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. + * ?> + * ``` + * + * @param $checkbox + * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() + */ + public function dontSeeCheckboxIsChecked($checkbox) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` php + * seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInField() + */ + public function canSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` php + * seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::seeInField() + */ + public function seeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` php + * dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function cantSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` php + * dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::dontSeeInField() + */ + public function dontSeeInField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInFormFields() + */ + public function canSeeInFormFields($formSelector, $params) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Lib\InnerBrowser::seeInFormFields() + */ + public function seeInFormFields($formSelector, $params) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() + */ + public function cantSeeInFormFields($formSelector, $params) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() + */ + public function dontSeeInFormFields($formSelector, $params) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Submits the given form on the page, optionally with the given form values. + * Give the form fields values as an array. + * + * Skipped fields will be filled by their values from the page. + * You don't need to click the 'Submit' button afterwards. + * This command itself triggers the request to form's action. + * + * You can optionally specify what button's value to include + * in the request with the last parameter as an alternative to + * explicitly setting its value in the second parameter, as + * button values are not otherwise included in the request. + * + * Examples: + * + * ``` php + * submitForm('#login', array('login' => 'davert', 'password' => '123456')); + * // or + * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'), 'submitButtonName'); + * + * ``` + * + * For example, given this sample "Sign Up" form: + * + * ``` html + * + * Login:
    + * Password:
    + * Do you agree to out terms?
    + * Select pricing plan + * + * + * ``` + * + * You could write the following to submit it: + * + * ``` php + * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)), 'submitButton'); + * + * ``` + * Note that "2" will be the submitted value for the "plan" field, as it is the selected option. + * + * You can also emulate a JavaScript submission by not specifying any buttons in the third parameter to submitForm. + * + * ```php + * submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); + * + * ``` + * + * Pair this with seeInFormFields for quick testing magic. + * + * ``` php + * 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * Parameter values can be set to arrays for multiple input fields + * of the same name, or multi-select combo boxes. For checkboxes, + * either the string value can be used, or boolean values which will + * be replaced by the checkbox's value in the DOM. + * + * ``` php + * submitForm('#my-form', [ + * 'field1' => 'value', + * 'checkbox' => [ + * 'value of first checkbox', + * 'value of second checkbox, + * ], + * 'otherCheckboxes' => [ + * true, + * false, + * false + * ], + * 'multiselect' => [ + * 'first option value', + * 'second option value' + * ] + * ]); + * ?> + * ``` + * + * Mixing string and boolean values for a checkbox's value is not + * supported and may produce unexpected results. + * + * @param $selector + * @param $params + * @param $button + * @see \Codeception\Lib\InnerBrowser::submitForm() + */ + public function submitForm($selector, $params, $button = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fills a text field or textarea with the given string. + * + * ``` php + * fillField("//input[@type='text']", "Hello World!"); + * $I->fillField(['name' => 'email'], 'jon@mail.com'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Lib\InnerBrowser::fillField() + */ + public function fillField($field, $value) { + return $this->scenario->runStep(new \Codeception\Step\Action('fillField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Selects an option in a select tag or in radio button group. + * + * ``` php + * selectOption('form select[name=account]', 'Premium'); + * $I->selectOption('form input[name=payment]', 'Monthly'); + * $I->selectOption('//form/select[@name=account]', 'Monthly'); + * ?> + * ``` + * + * Provide an array for the second argument to select multiple options: + * + * ``` php + * selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * + * @param $select + * @param $option + * @see \Codeception\Lib\InnerBrowser::selectOption() + */ + public function selectOption($select, $option) { + return $this->scenario->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. + * + * ``` php + * checkOption('#agree'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::checkOption() + */ + public function checkOption($option) { + return $this->scenario->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unticks a checkbox. + * + * ``` php + * uncheckOption('#notify'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Lib\InnerBrowser::uncheckOption() + */ + public function uncheckOption($option) { + return $this->scenario->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Attaches a file relative to the Codeception data directory to the given file upload field. + * + * ``` php + * attachFile('input[@type="file"]', 'prices.xls'); + * ?> + * ``` + * + * @param $field + * @param $filename + * @see \Codeception\Lib\InnerBrowser::attachFile() + */ + public function attachFile($field, $filename) { + return $this->scenario->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends a GET ajax request with specified params. + * + * See ->sendAjaxPostRequest for examples. + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() + */ + public function sendAjaxGetRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends a POST ajax request with specified params. + * Additional params can be passed as array. + * + * Example: + * + * Imagine that by clicking checkbox you trigger ajax request which updates user settings. + * We emulate that click by running this ajax request manually. + * + * ``` php + * sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET + * + * ``` + * + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() + */ + public function sendAjaxPostRequest($uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * If your page triggers an ajax request, you can perform it manually. + * This action sends an ajax request with specified method and params. + * + * Example: + * + * You need to perform an ajax request specifying the HTTP method. + * + * ``` php + * sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); + * + * ``` + * + * @param $method + * @param $uri + * @param $params + * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() + */ + public function sendAjaxRequest($method, $uri, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns the text contents of the given element. + * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. + * + * ``` php + * grabTextFrom('h1'); + * $heading = $I->grabTextFrom('descendant-or-self::h1'); + * $value = $I->grabTextFrom('~ + * ``` + * + * @param $cssOrXPathOrRegex + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabTextFrom() + */ + public function grabTextFrom($cssOrXPathOrRegex) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs the value of the given attribute value from the given element. + * Fails if element is not found. + * + * ``` php + * grabAttributeFrom('#tooltip', 'title'); + * ?> + * ``` + * + * + * @param $cssOrXpath + * @param $attribute + * @internal param $element + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() + */ + public function grabAttributeFrom($cssOrXpath, $attribute) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $field + * + * @return array|mixed|null|string + * @see \Codeception\Lib\InnerBrowser::grabValueFrom() + */ + public function grabValueFrom($field) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets a cookie with the given name and value. + * You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument. + * + * ``` php + * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); + * ?> + * ``` + * + * @param $name + * @param $val + * @param array $params + * @internal param $cookie + * @internal param $value + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::setCookie() + */ + public function setCookie($name, $val, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs a cookie value. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::grabCookie() + */ + public function grabCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function canSeeCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeCookie() + */ + public function seeCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function cantSeeCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() + */ + public function dontSeeCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unsets cookie with the given name. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Lib\InnerBrowser::resetCookie() + */ + public function resetCookie($name, $params = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeElement() + */ + public function canSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * @see \Codeception\Lib\InnerBrowser::seeElement() + */ + public function seeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function cantSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @see \Codeception\Lib\InnerBrowser::dontSeeElement() + */ + public function dontSeeElement($selector, $attributes = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected: + * - string: strict number + * - array: range of numbers [0,10] + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() + */ + public function canSeeNumberOfElements($selector, $expected) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected: + * - string: strict number + * - array: range of numbers [0,10] + * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() + */ + public function seeNumberOfElements($selector, $expected) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function canSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() + */ + public function seeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function cantSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() + */ + public function dontSeeOptionIsSelected($select, $optionText) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that current page has 404 response status code. + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seePageNotFound() + */ + public function canSeePageNotFound() { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that current page has 404 response status code. + * @see \Codeception\Lib\InnerBrowser::seePageNotFound() + */ + public function seePageNotFound() { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * @param $code + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() + */ + public function canSeeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is equal to value provided. + * + * @param $code + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() + */ + public function seeResponseCodeIs($code) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function canSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::seeInTitle() + */ + public function seeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function cantSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() + */ + public function dontSeeInTitle($title) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); + } +} diff --git a/tests/acceptance/_bootstrap.php b/tests/acceptance/_bootstrap.php new file mode 100644 index 000000000..8a8855580 --- /dev/null +++ b/tests/acceptance/_bootstrap.php @@ -0,0 +1,2 @@ + */ - -if(!defined('FOLLOW_REQUEST_SSL')) define('FOLLOW_REQUEST_SSL',0); -if(!defined('ENFORCE_SSL')) define('ENFORCE_SSL',1); -if(!defined('RELEASE_SSL')) define('RELEASE_SSL',2); -if(!defined('MOCK_CONTEXT')) define('MOCK_CONTEXT', 1); - -class Context -{ - public static $mock_vars = array(); - private static $useCdn = 'N'; - private static $requestUrl = 'http://www.test.com'; - - public function gets() { - $args = func_get_args(); - $output = new stdClass; - - foreach($args as $name) { - $output->{$name} = self::$mock_vars[$name]; - } - - return $output; - } - - public function get($name) { - return array_key_exists($name, self::$mock_vars)?self::$mock_vars[$name]:''; - } - - public function getRequestVars() { - return self::$mock_vars; - } - - public function set($name, $value) { - self::$mock_vars[$name] = $value; - } - - public function getLangType() { - return 'en'; - } - - public function getLang($str) { - return $str; - } - - public function truncate() { - self::$mock_vars = array(); - } - - public static function setUseCdn($useCdn) - { - self::$useCdn = $useCdn != 'Y' ? 'N':'Y'; - } - - public static function getDBInfo() { - $dbInfo = new stdClass(); - $dbInfo->use_cdn = self::$useCdn; - - return $dbInfo; - } - - - public static function setRequestUrl($url) - { - self::$requestUrl= $url; - } - - public static function getRequestUrl() { - return self::$requestUrl; - } -} - -/* End of file Context.mock.php */ -/* Location: ./tests/classes/context/Context.mock.php */ diff --git a/tests/classes/context/ContextTest.php b/tests/classes/context/ContextTest.php deleted file mode 100644 index d4551b4d6..000000000 --- a/tests/classes/context/ContextTest.php +++ /dev/null @@ -1,86 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; - -require_once _XE_PATH_.'classes/context/Context.class.php'; -require_once _XE_PATH_.'classes/handler/Handler.class.php'; -require_once _XE_PATH_.'classes/frontendfile/FrontEndFileHandler.class.php'; - -class ContextTest extends PHPUnit_Framework_TestCase -{ - /** - * test whether the singleton works - */ - public function testGetInstance() - { - $this->assertInstanceOf('Context', Context::getInstance()); - $this->assertSame(Context::getInstance(), Context::getInstance()); - } - - public function testSetGetVars() - { - $this->assertSame(Context::get('var1'), null); - Context::set('var1', 'val1'); - $this->assertSame(Context::get('var1'), 'val1'); - - Context::set('var2', 'val2'); - $this->assertSame(Context::get('var2'), 'val2'); - Context::set('var3', 'val3'); - $data = new stdClass; - $data->var1 = 'val1'; - $data->var2 = 'val2'; - $this->assertEquals(Context::gets('var1','var2'), $data); - $data->var3 = 'val3'; - $this->assertEquals(Context::getAll(), $data); - } - - public function testAddGetBodyClass() - { - $this->assertEquals(Context::getBodyClass(), ''); - Context::addBodyClass('red'); - $this->assertEquals(Context::getBodyClass(), ' class="red"'); - Context::addBodyClass('green'); - $this->assertEquals(Context::getBodyClass(), ' class="red green"'); - Context::addBodyClass('blue'); - $this->assertEquals(Context::getBodyClass(), ' class="red green blue"'); - - // remove duplicated class - Context::addBodyClass('red'); - $this->assertEquals(Context::getBodyClass(), ' class="red green blue"'); - } - - public function testRequsetResponseMethod() - { - $this->assertEquals(Context::getRequestMethod(), 'GET'); - - $_SERVER['REQUEST_METHOD'] = 'POST'; - Context::setRequestMethod(); - $this->assertEquals(Context::getRequestMethod(), 'POST'); - - $GLOBALS['HTTP_RAW_POST_DATA'] = 'abcde'; - Context::setRequestMethod(); - $this->assertEquals(Context::getRequestMethod(), 'XMLRPC'); - - $_SERVER['CONTENT_TYPE'] = 'application/json'; - Context::setRequestMethod(); - $this->assertEquals(Context::getRequestMethod(), 'JSON'); - - Context::setRequestMethod('POST'); - $this->assertEquals(Context::getRequestMethod(), 'POST'); - - $this->assertEquals(Context::getResponseMethod(), 'HTML'); - Context::setRequestMethod('JSON'); - $this->assertEquals(Context::getResponseMethod(), 'JSON'); - - Context::setResponseMethod('WRONG_TYPE'); - $this->assertEquals(Context::getResponseMethod(), 'HTML'); - Context::setResponseMethod('XMLRPC'); - $this->assertEquals(Context::getResponseMethod(), 'XMLRPC'); - Context::setResponseMethod('HTML'); - $this->assertEquals(Context::getResponseMethod(), 'HTML'); - } -} - -/* End of file ContextTest.php */ -/* Location: ./tests/classes/context/ContextTest.php */ diff --git a/tests/classes/db/Helper.class.php b/tests/classes/db/Helper.class.php deleted file mode 100644 index e3aa4ad02..000000000 --- a/tests/classes/db/Helper.class.php +++ /dev/null @@ -1,24 +0,0 @@ - */ - - class Helper { - static function cleanString($query){ - $query = trim(preg_replace('/\s+/', ' ',$query)); - $query = preg_replace('/\t+/', '',$query); - $query = str_replace(" , ", ', ', $query); - $query = str_replace(" ,", ',', $query); - $query = str_replace("( ", '(', $query); - $query = str_replace(" )", ')', $query); - $query = str_replace(array("\r", "\r\n", "\n"), '*', $query); - $query = strtolower($query); - return $query; - } - - static function getXmlObject($xml_file){ - $xmlParser = XmlQueryParser::getInstance(); - return $xmlParser->getXmlFileContent($xml_file); - } - - } - -?> diff --git a/tests/classes/db/QueryTester.class.php b/tests/classes/db/QueryTester.class.php deleted file mode 100644 index f827529da..000000000 --- a/tests/classes/db/QueryTester.class.php +++ /dev/null @@ -1,321 +0,0 @@ - */ - -// Only supports queries inside modules for now - - class QueryTester { - - function QueryTester(){ - - } - - function getQueryPath($type, $name, $query_name){ - return _XE_PATH_ . $type ."/".$name."/queries/" . $query_name . ".xml"; - } - - function getNewParserOutput($xml_file){ - $newXmlQueryParser = new XmlQueryParser(); - $xml_obj = $newXmlQueryParser->getXmlFileContent($xml_file); - $parser = new QueryParser($xml_obj->query); - return $parser->toString(); - } - - function getOldParserOutput($query_id, $xml_file){ - $cache_file = _TEST_PATH_ . "cache/".$query_id.'.cache.php'; - $parser = new OldXmlQueryParser(); - $parser->parse($query_id, $xml_file, $cache_file); - $buff = FileHandler::readFile($cache_file); - return $buff; - } - - function cleanOutputAndAddArgs($outputString, $argsString = ''){ - $outputString = str_replace("", "", $outputString); - $outputString = $argsString . $outputString; - return $outputString; - } - - function getXmlFileContent($xml_file){ - return FileHandler::readFile($xml_file); - } - - function printOutput($output){ - if(is_object($output)) { - var_dump($output); return; - } - $output = htmlspecialchars($output, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); - - $output = preg_replace('/select/i', 'SELECT', $output); - $output = preg_replace('/from/i', '
    FROM', $output); - $output = preg_replace('/where/i', '
    WHERE', $output); - $output = preg_replace('/group by/i', '
    GROUP BY', $output); - $output = preg_replace('/order by/i', '
    ORDER BY', $output); - - $output = str_replace("\n", "
    ", $output); - - echo '
    '
    -					.$output
    -				.'
    '; - } - - function getNewParserOutputString($xml_file, $argsString){ - $outputString = ''; - $outputString = $this->getNewParserOutput($xml_file); - $outputString = $this->cleanOutputAndAddArgs($outputString, $argsString); - return $outputString; - } - - function getNewParserQuery($outputString){ - //echo $outputString; - //exit(0); - $output = eval($outputString); - if(is_a($output, 'Object')) - if(!$output->toBool()) return("Date incorecte! Query-ul nu a putut fi executat."); - $db = new DBCubrid(); - if($output->getAction() == 'select') - return $db->getSelectSql($output); - else if($output->getAction() == 'insert') - return $db->getInsertSql($output); - else if($output->getAction() == 'update') - return $db->getUpdateSql($output); - else if($output->getAction() == 'delete') - return $db->getDeleteSql($output); - } - - function testNewParser($xml_file, $escape_char, $argsString, $show_output_string){ - $outputString = $this->getNewParserOutputString($xml_file, $escape_char, $argsString); - $query = $this->getNewParserQuery($outputString); - - echo ''; - if($show_output_string){ - echo ''; - } - - echo ''; - echo ''; - } - - function getOldParserOutputString($query_id, $xml_file, $argsString){ - $outputString = $this->getOldParserOutput($query_id, $xml_file); - $outputString = $this->cleanOutputAndAddArgs($outputString, $argsString); - return $outputString; - } - - function getOldParserQuery($outputString){ - $output = eval($outputString); - if(is_a($output, 'Object')) - if(!$output->toBool()) exit("Date incorecte! Query-ul nu a putut fi executat."); - - /* SQL Server - * - $db = new DBMssql(false); - if($output->action == "select") - return $db->_executeSelectAct($output); - else if($output->action == "insert") - return $db->_executeInsertAct($output); - else if($output->action == "delete") - return $db->_executeDeleteAct($output); - else if($output->action == "update") - return $db->_executeUpdateAct($output); - */ - - /* - * Mysql - */ - $db = new DBMysql(false); - if($output->action == "select") - $db->_executeSelectAct($output); - else if($output->action == "insert") - $db->_executeInsertAct($output); - else if($output->action == "delete") - $db->_executeDeleteAct($output); - else if($output->action == "update") - $db->_executeUpdateAct($output); - return $db->getLatestQuery(); - } - - function testOldParser($query_id, $xml_file, $argsString, $show_output_string){ - $outputString = $this->getOldParserOutputString($query_id, $xml_file, $argsString); - $query = $this->getOldParserQuery($outputString); - - - echo ''; - if($show_output_string){ - echo ''; - } - - echo ''; - echo ''; - } - - function showXmlInputFile($xml_file){ - echo ''; - echo ''; - } - - function test($query_id, $xml_file, $argsString, $show_output_string, $escape_char = '"'){ - echo "

    $query_id

    "; - echo '
    '; - $this->printOutput($outputString); - echo ''; - $this->printOutput($query); - echo '
    '; - $this->printOutput($outputString); - echo ''; - $this->printOutput($query); - echo '
    '; - $xml_file_content = $this->getXmlFileContent($xml_file); - $this->printOutput($xml_file_content); - echo '
    '; - - $this->showXmlInputFile($xml_file); - - $this->testNewParser($xml_file, $escape_char, $argsString, $show_output_string); - - //$this->testOldParser($query_id, $xml_file, $argsString, $show_output_string); - - echo '
    '; - } - - function test_addon_getAddonInfo($show_output_string = false){ - $argsString = '$args->addon = "captcha";'; - $this->test("modules.addon.getAddonInfo" - , $this->getQueryPath("modules", "addon", "getAddonInfo") - , $argsString - , $show_output_string); - } - - function test_addon_getAddons($show_output_string = false){ - $argsString = ''; - $this->test("modules.addon.getAddons" - , $this->getQueryPath("modules", "addon", "getAddons") - , $argsString - , $show_output_string); - } - - function test_admin_getCommentCount($show_output_string = false){ - $argsString = ''; - $this->test("modules.admin.getCommentCount" - , $this->getQueryPath("modules", "admin", "getCommentCount") - , $argsString - , $show_output_string); - } - - function test_admin_getCommentDeclaredStatus($show_output_string = false){ - $argsString = '$args->date = "20110411";'; - $this->test("modules.admin.getCommentDeclaredStatus" - , $this->getQueryPath("modules", "admin", "getCommentDeclaredStatus") - , $argsString - , $show_output_string); - } - - function test_module_getDefaultModules($show_output_string = false){ - $argsString = ''; - $this->test("modules.module.getDefaultModules" - , $this->getQueryPath("modules", "module", "getDefaultModules") - , $argsString - , $show_output_string); - } - - function test_module_getModuleCategories($show_output_string = false){ - $argsString = ''; - $this->test("modules.module.getModuleCategories" - , $this->getQueryPath("modules", "module", "getModuleCategories") - , $argsString - , $show_output_string); - } - - function test_module_getNonuniqueDomains($show_output_string = false){ - $argsString = ''; - $this->test("modules.module.getNonuniqueDomains" - , $this->getQueryPath("modules", "module", "getNonuniqueDomains") - , $argsString - , $show_output_string); - } - - function test_module_getAdminId($show_output_string = false){ - $argsString = '$args->module_srl = 23;'; - $this->test("modules.module.getAdminId" - , $this->getQueryPath("modules", "module", "getAdminId") - , $argsString - , $show_output_string); - } - function test_module_getSiteInfo($show_output_string = false){ - $argsString = '$args->site_srl = 0;'; - $this->test("modules.module.getSiteInfo" - , $this->getQueryPath("modules", "module", "getSiteInfo") - , $argsString - , $show_output_string); - } - function test_module_insertModule($show_output_string = false){ - $argsString = ' $args->module_category_srl = 0; - $args->browser_title = "test"; - $args->layout_srl = 0; - $args->mlayout_srl = 0; - $args->module = "page"; - $args->mid = "test"; - $args->site_srl = 0; - $args->module_srl = 47374;'; - $this->test("modules.module.insertModule" - , $this->getQueryPath("modules", "module", "insertModule") - , $argsString - , $show_output_string); - } - function test_module_updateModule($show_output_string = false){ - $argsString = ' $args->module_category_srl = 0; - $args->browser_title = "test"; - $args->layout_srl = 0; - $args->mlayout_srl = 0; - $args->module = "page"; - $args->mid = "test"; - $args->use_mobile = ""; - $args->site_srl = 0; - $args->module_srl = 47374;'; - $this->test("modules.module.updateModule" - , $this->getQueryPath("modules", "module", "updateModule") - , $argsString - , $show_output_string); - } - function test_admin_deleteActionForward($show_output_string = false){ - $argsString = '$args->module = "page"; - $args->type = "page"; - $args->act = "tata";'; - $this->test("modules.admin.deleteActionForward" - , $this->getQueryPath("modules", "module", "deleteActionForward") - , $argsString - , $show_output_string); - } - - function test_member_getAutologin($show_output_string = false){ - $argsString = '$args->autologin_key = 10;'; - $this->test("modules.member.getAutologin" - , $this->getQueryPath("modules", "member", "getAutologin") - , $argsString - , $show_output_string); - } - - function test_opage_getOpageList($show_output_string = false){ - $argsString = '$args->s_title = "yuhuu"; - $args->module = 12;'; - $this->test("modules.opage.getOpageList" - , $this->getQueryPath("modules", "opage", "getOpageList") - , $argsString - , $show_output_string); - } - function test_getPageList($show_output_string = false){ - $argsString = '$args->sort_index = "module_srl"; - $args->page_count = 10; - $args->s_module_category_srl = 0; - $args->s_mid = "test"; - $args->s_browser_title = "caca";'; - - $this->test("modules.page.getPageList" - , $this->getQueryPath("modules", "page", "getPageList") - , $argsString - , $show_output_string); - } - - - - } -?> diff --git a/tests/classes/db/classes/db/queryparts/condition/ConditionWithArgumentTest.php b/tests/classes/db/classes/db/queryparts/condition/ConditionWithArgumentTest.php deleted file mode 100644 index 4b99ab824..000000000 --- a/tests/classes/db/classes/db/queryparts/condition/ConditionWithArgumentTest.php +++ /dev/null @@ -1,93 +0,0 @@ - */ - -/** - * Test class for ConditionWithArgument. - */ -class ConditionWithArgumentTest extends CubridTest { - - /** - * Checks equal operation - */ - public function testConditionString_Equal_WithoutPipe_NumericValue() { - $member_srl_argument = new ConditionArgument('"member_srl"', 20, 'equal'); - - $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'equal', null); - - $this->assertEquals(' "member_srl" = 20', $tag->toString()); - } - - /** - * Checks equal operation - */ - public function testConditionString_Equal_WithPipe_NumericValue() { - $member_srl_argument = new ConditionArgument('"member_srl"', 20, 'equal'); - - $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'equal', 'and'); - - $this->assertEquals('and "member_srl" = 20', $tag->toString()); - } - - /** - * Checks condition returns nothing when argument is not valid - */ - public function testConditionString_InvalidArgument() { - $member_srl_argument = new ConditionArgument('"member_srl"', null, 'equal'); - $member_srl_argument->checkNotNull(); - - $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'equal', 'and'); - - $this->assertEquals('', $tag->toString()); - } - - /** - * Checks "in" operation - */ - public function testConditionString_In_VarcharArray() { - $member_srl_argument = new ConditionArgument('"member_srl"', array('a', 'b', 'c'), 'in'); - $member_srl_argument->createConditionValue(); - $member_srl_argument->setColumnType('varchar'); - - $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'in'); - - $this->assertEquals(' "member_srl" in (\'a\',\'b\',\'c\')', $tag->toString()); - } - - /** - * Checks and operation - */ - public function testConditionString_And() { - $tag = new ConditionWithoutArgument('"member_srl"', "20", 'and', null); - - $this->assertEquals(' "member_srl" & 20', $tag->toString()); - } - - /** - * Checks or operation - */ - public function testConditionString_Or() { - $tag = new ConditionWithoutArgument('"member_srl"', "20", 'or', null); - - $this->assertEquals(' "member_srl" | 20', $tag->toString()); - } - - /** - * Checks xor operation - */ - public function testConditionString_Xor() { - $tag = new ConditionWithoutArgument('"member_srl"', "20", 'xor', null); - - $this->assertEquals(' "member_srl" ^ 20', $tag->toString()); - } - - /** - * Checks not operation - */ - public function testConditionString_Not() { - $tag = new ConditionWithoutArgument('"member_srl"', "20", 'not', null); - - $this->assertEquals(' "member_srl" ~ 20', $tag->toString()); - } -} - -?> diff --git a/tests/classes/db/classes/db/queryparts/table/TableTest.php b/tests/classes/db/classes/db/queryparts/table/TableTest.php deleted file mode 100644 index 96ef0f230..000000000 --- a/tests/classes/db/classes/db/queryparts/table/TableTest.php +++ /dev/null @@ -1,43 +0,0 @@ - */ - - /** - * Test class for Table. - */ -class TableTest extends CubridTest -{ - /** - * @var Table - */ - protected $object; - - protected function setUp() - { - $this->object = new Table('"xe_member"', '"m"'); - } - - protected function tearDown() - { - } - - public function testToString() - { - $this->assertEquals('"xe_member" as "m"', $this->object->toString()); - } - - public function testGetName() - { - $this->assertEquals('"xe_member"', $this->object->getName()); - } - - public function testGetAlias() - { - $this->assertEquals('"m"', $this->object->getAlias()); - } - - public function testIsJoinTable() - { - $this->assertEquals(false, $this->object->isJoinTable()); - } -} -?> diff --git a/tests/classes/db/classes/xml/xmlquery/argument/ArgumentTest.php b/tests/classes/db/classes/xml/xmlquery/argument/ArgumentTest.php deleted file mode 100644 index ca44d5dda..000000000 --- a/tests/classes/db/classes/xml/xmlquery/argument/ArgumentTest.php +++ /dev/null @@ -1,281 +0,0 @@ - */ - -/** - * Test class for Argument. - * Generated by PHPUnit on 2011-07-07 at 16:51:29. - */ -class ArgumentTest extends CubridTest { - - public function testErrorMessageIsSent_NotNullCheck(){ - global $lang; - include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); - $page_argument = new Argument('page', $args->page); - $page_argument->checkNotNull(); - $this->assertFalse($page_argument->isValid()); - $this->assertEquals("Please input a value for page", $page_argument->getErrorMessage()->message); - } - - public function testErrorMessageIsSent_MinLengthCheck(){ - global $lang; - include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); - - $args->page = '123'; - $page_argument = new Argument('page', $args->page); - $page_argument->checkMinLength(6); - $this->assertFalse($page_argument->isValid()); - $this->assertEquals("Please align the text length of page", $page_argument->getErrorMessage()->message); - } - - public function testErrorMessageIsSent_MaxLengthCheck(){ - global $lang; - include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); - - $args->page = '123'; - $page_argument = new Argument('page', $args->page); - $page_argument->checkMaxLength(2); - $this->assertFalse($page_argument->isValid()); - $this->assertEquals("Please align the text length of page", $page_argument->getErrorMessage()->message); - } - - /** - * @todo Implement testGetType(). - */ - public function testGetType() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testSetColumnType(). - */ - public function testSetColumnType() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testGetName(). - */ - public function testGetName() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testGetValue(). - */ - public function testGetValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testGetUnescapedValue(). - */ - public function testGetUnescapedValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testToString(). - */ - public function testToString() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testEscapeValue(). - */ - public function testEscapeValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testIsValid(). - */ - public function testIsValid() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testGetErrorMessage(). - */ - public function testGetErrorMessage() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testEnsureDefaultValue(). - */ - public function testEnsureDefaultValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testCheckFilter(). - */ - public function testCheckFilter() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testCheckMaxLength(). - */ - public function testCheckMaxLength() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testCheckMinLength(). - */ - public function testCheckMinLength() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * Checks that argument is valid after a notnull check when value is not null - */ - public function testCheckNotNullWhenNotNull() { - $member_srl_argument = new ConditionArgument('member_srl', 20, 'equal'); - $member_srl_argument->checkNotNull(); - - $this->assertEquals(true, $member_srl_argument->isValid()); - } - - /** - * Checks that argument becomes invalid after a notnull check when value is null - */ - public function testCheckNotNullWhenNull() { - $member_srl_argument = new ConditionArgument('member_srl', null, 'equal'); - $member_srl_argument->checkNotNull(); - - $this->assertEquals(false, $member_srl_argument->isValid()); - } - - /** - * Checks that argument value stays the same when both user value and default value are given - */ - public function testCheckDefaultValueWhenNotNull() { - $member_srl_argument = new ConditionArgument('member_srl', 20, 'equal'); - $member_srl_argument->ensureDefaultValue(25); - - $this->assertEquals(20, $member_srl_argument->getValue()); - } - - /** - * Checks that argument value gets set when user value is null and default value is specified - */ - public function testCheckDefaultValueWhenNull() { - $member_srl_argument = new ConditionArgument('member_srl', null, 'equal'); - $member_srl_argument->ensureDefaultValue(25); - - $this->assertEquals(25, $member_srl_argument->getValue()); - } - - /** - * Checks like prefix operation - */ - public function testCreateConditionValue_LikePrefix() { - $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_prefix'); - $member_srl_argument->createConditionValue(); - - $this->assertEquals('\'forum%\'', $member_srl_argument->getValue()); - } - - /** - * Checks like tail operation - */ - public function testCreateConditionValue_LikeTail() { - $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_tail'); - $member_srl_argument->createConditionValue(); - - $this->assertEquals('\'%forum\'', $member_srl_argument->getValue()); - } - - /** - * Checks like operation - */ - public function testCreateConditionValue_Like() { - $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like'); - $member_srl_argument->createConditionValue(); - - $this->assertEquals('\'%forum%\'', $member_srl_argument->getValue()); - } - - - /** - * Checks in operation - */ - public function testCreateConditionValue_In_StringValues() { - $member_srl_argument = new ConditionArgument('"mid"', array('forum', 'board'), 'in'); - $member_srl_argument->createConditionValue(); - $member_srl_argument->setColumnType('varchar'); - - $this->assertEquals('(\'forum\',\'board\')', $member_srl_argument->getValue()); - } - - /** - * Checks in operation - */ - public function testCreateConditionValue_In_NumericValues() { - $member_srl_argument = new ConditionArgument('"module_srl"', array(3, 21), 'in'); - $member_srl_argument->setColumnType('number'); - $member_srl_argument->createConditionValue(); - - $this->assertEquals('(3,21)', $member_srl_argument->getValue()); - } - - public function testEnsureDefaultValueWithEmptyString(){ - $homepage_argument = new Argument('homepage', ''); - $homepage_argument->ensureDefaultValue(''); - $homepage_argument->checkFilter('homepage'); - if(!$homepage_argument->isValid()) return $homepage_argument->getErrorMessage(); - $homepage_argument->setColumnType('varchar'); - - - $this->assertEquals('\'\'', $homepage_argument->getValue()); - } - - public function testDefaultValue() { - $default = new DefaultValue("var", ''); - $this->assertEquals('\'\'', $default->toString()); - } -} - -?> diff --git a/tests/classes/db/classes/xml/xmlquery/argument/ConditionArgumentTest.php b/tests/classes/db/classes/xml/xmlquery/argument/ConditionArgumentTest.php deleted file mode 100644 index 23ded1838..000000000 --- a/tests/classes/db/classes/xml/xmlquery/argument/ConditionArgumentTest.php +++ /dev/null @@ -1,65 +0,0 @@ - */ - -/** - * Test class for ConditionArgument. - */ -class ConditionArgumentTest extends CubridTest { - - function testIn(){ - $args->document_srl = 1234; - $document_srl_argument = new ConditionArgument('document_srl', $args->document_srl, 'in'); - $document_srl_argument->checkNotNull(); - $document_srl_argument->createConditionValue(); - if(!$document_srl_argument->isValid()) return $document_srl_argument->getErrorMessage(); - $document_srl_argument->setColumnType('number'); - - $condition = new ConditionWithArgument('"extra_vars"."document_srl"',$document_srl_argument,"in", 'and'); - $this->assertEquals('and "extra_vars"."document_srl" in (1234)', $condition->toString()); - } - - function testZeroValue(){ - $args->site_srl = 0; - $site_srl_argument = new ConditionArgument('site_srl', $args->site_srl, 'equal'); - $site_srl_argument->checkNotNull(); - $site_srl_argument->createConditionValue(); - if(!$site_srl_argument->isValid()) return $site_srl_argument->getErrorMessage(); - $site_srl_argument->setColumnType('number'); - - $condition = new ConditionWithArgument('"sites"."site_srl"',$site_srl_argument,"equal"); - $this->assertEquals(' "sites"."site_srl" = 0', $condition->toString()); - } - - /** - * @todo Implement testCreateConditionValue(). - */ - public function testCreateConditionValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testGetType(). - */ - public function testGetType() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @todo Implement testSetColumnType(). - */ - public function testSetColumnType() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - -} - -?> diff --git a/tests/classes/db/classes/xml/xmlquery/argument/data/en.lang.php b/tests/classes/db/classes/xml/xmlquery/argument/data/en.lang.php deleted file mode 100644 index 9d07584f7..000000000 --- a/tests/classes/db/classes/xml/xmlquery/argument/data/en.lang.php +++ /dev/null @@ -1,323 +0,0 @@ - */ -/** - * @file common/lang/en.lang.php - * @author NAVER (developers@xpressengine.com) - * @brief English Language Pack (Only basic words are included here) - **/ - -// words for action, which is basically used -$lang->cmd_write = 'Write'; -$lang->cmd_reply = 'Reply'; -$lang->cmd_delete = 'Delete'; -$lang->cmd_modify = 'Modify'; -$lang->cmd_edit = 'Edit'; -$lang->cmd_view = 'View'; -$lang->cmd_view_all = 'View All'; -$lang->cmd_list = 'List'; -$lang->cmd_prev = 'Prev'; -$lang->cmd_next = 'Next'; -$lang->cmd_send_trackback = 'Send Trackback'; -$lang->cmd_registration = $lang->cmd_submit = 'Submit'; -$lang->cmd_comment_registration = 'Add Comment'; -$lang->cmd_insert = 'Insert'; -$lang->cmd_save = 'Save'; -$lang->cmd_load = 'Load'; -$lang->cmd_input = 'Input'; -$lang->cmd_search = 'Search'; -$lang->cmd_find = 'Find'; -$lang->cmd_replace = 'Replace'; -$lang->cmd_confirm = 'Confirm'; -$lang->cmd_cancel = 'Cancel'; -$lang->cmd_back = 'Go Back'; -$lang->cmd_vote = 'Recommend'; -$lang->cmd_vote_down = 'Criticize'; -$lang->cmd_declare = 'Accuse'; -$lang->cmd_cancel_declare = 'Cancel Accuse'; -$lang->cmd_declared_list = 'Accusations List'; -$lang->cmd_copy = 'Copy'; -$lang->cmd_move = 'Move'; -$lang->cmd_move_up = 'Up'; -$lang->cmd_move_down = 'Down'; -$lang->cmd_add_indent = 'Indent'; -$lang->cmd_remove_indent = 'Outdent'; -$lang->cmd_management = 'Manage'; -$lang->cmd_make = 'Create'; -$lang->cmd_select = 'Select'; -$lang->cmd_select_all = 'Select All'; -$lang->cmd_unselect_all = 'Deselect All'; -$lang->cmd_reverse_all = 'Reverse'; -$lang->cmd_close_all = 'Close All'; -$lang->cmd_open_all = 'Open All'; -$lang->cmd_reload = 'Reload'; -$lang->cmd_close = 'Close'; -$lang->cmd_open = 'Open'; -$lang->cmd_setup = 'Configure'; -$lang->cmd_addition_setup = 'Additional Setup'; -$lang->cmd_option = 'Option'; -$lang->cmd_apply = 'Apply'; -$lang->cmd_open_calendar = 'Select a Date'; -$lang->cmd_send = 'Send'; -$lang->cmd_print = 'Print'; -$lang->cmd_scrap = 'Scrap'; -$lang->cmd_preview = 'Preview'; -$lang->cmd_reset = 'Reset'; -$lang->cmd_remake_cache = "Re-create cache file"; -$lang->cmd_publish = "Publish"; -$lang->cmd_layout_setup = 'Configure layout'; -$lang->cmd_layout_edit = 'Edit layout'; -$lang->cmd_search_by_ipaddress = 'Search by IP Address'; -$lang->cmd_add_ip_to_spamfilter = 'Add IP to spamfilter'; - -$lang->enable = 'Enable'; -$lang->disable = 'Disable'; - -// Essential Words -$lang->menu = 'Menu'; -$lang->no = 'No.'; -$lang->notice = 'Notice'; -$lang->secret = 'Secret'; -$lang->category = $lang->category_srl = 'Category'; -$lang->none_category = 'None category'; -$lang->none_image = 'Image does not exist'; -$lang->document_srl = 'Doc. No.'; -$lang->user_id = 'User ID'; -$lang->author = 'Developer'; -$lang->password = 'Password'; -$lang->password1 = 'Password'; -$lang->password2 = 'Retype Password'; -$lang->admin_id = 'Admin ID'; -$lang->writer = 'Author'; -$lang->user_name = 'User Name'; -$lang->nick_name = 'Nick Name'; -$lang->email_address = 'Email'; -$lang->homepage = 'Homepage'; -$lang->blog = 'Blog'; -$lang->birthday = 'Birthday'; -$lang->browser_title = 'Browser Title'; -$lang->title = 'Subject'; -$lang->title_content = 'Subject+Content'; -$lang->topic = 'Topic'; -$lang->replies = 'Reply'; -$lang->content = 'Content'; -$lang->document = 'Article'; -$lang->comment = 'Comment'; -$lang->description = 'Description'; -$lang->trackback = 'Trackback'; -$lang->tag = 'Tag'; -$lang->allow_comment = 'Allow Comments'; -$lang->lock_comment = 'Block Comments'; -$lang->allow_trackback = 'Allow Trackbacks'; -$lang->uploaded_file = 'Attachment'; -$lang->grant = 'Permission'; -$lang->target = 'Target'; -$lang->total = 'Total'; -$lang->total_count = 'Count Total'; -$lang->ipaddress = 'IP Address'; -$lang->path = 'Path'; -$lang->cart = 'Selected Item'; -$lang->friend = 'Friends'; -$lang->notify = 'Notification'; -$lang->order_target = 'Align Target'; -$lang->order_type = 'Sorting Type'; -$lang->order_asc = 'ascend'; -$lang->order_desc = 'descend'; -$lang->file = 'file'; - -$lang->mid = 'Module Name'; -$lang->sid = 'Site Name'; -$lang->layout = 'Layout'; -$lang->mobile_layout = 'Mobile Layout'; -$lang->widget = 'Widget'; -$lang->module = 'Module'; -$lang->skin = 'Theme'; -$lang->mobile_skin = 'Mobile Theme'; -$lang->colorset = 'Colorset'; -$lang->extra_vars = 'Extra Vars'; - -$lang->domain = "Domain Name"; -$lang->url = "URL"; -$lang->document_url = 'Article URL'; -$lang->trackback_url = 'Trackback URL'; -$lang->blog_name = 'Blog Title'; -$lang->excerpt = 'Quotation'; - -$lang->document_count = 'Total Articles'; -$lang->page_count = 'Page Count'; -$lang->list_count = 'List Count'; -$lang->search_list_count = 'Search List Count'; -$lang->readed_count = 'Views'; -$lang->voted_count = 'Votes'; -$lang->comment_count = 'Comments'; -$lang->member_count = 'Member Count'; -$lang->date = 'Date'; -$lang->regdate = 'Registered Date'; -$lang->last_update = 'Last Update'; -$lang->last_post = 'Last Post'; -$lang->signup_date = 'Sign up Date'; -$lang->last_login = 'Last Sign in'; -$lang->first_page = 'First Page'; -$lang->last_page = 'Last Page'; -$lang->search_target = 'Target for Search'; -$lang->search_keyword = 'Keyword'; -$lang->is_default = 'Default'; - -$lang->no_documents = 'No Articles'; - -$lang->board_manager = 'Board Settings'; -$lang->member_manager = 'Member Settings'; -$lang->layout_manager = 'Layout Settings'; - -$lang->use = 'Use'; -$lang->notuse = 'Not use'; -$lang->not_exists = "Doesn't exist"; - -$lang->public = 'public'; -$lang->private = 'private'; - -$lang->unit_sec = 'sec'; -$lang->unit_min = 'min'; -$lang->unit_hour = 'hr'; -$lang->unit_day = 'th'; -$lang->unit_month = 'month'; -$lang->unit_year = 'year'; - -$lang->unit_week = array( - 'Monday' => 'Monday', - 'Tuesday' => 'Tuesday', - 'Wednesday' => 'Wednesday', - 'Thursday' => 'Thursday', - 'Friday' => 'Friday', - 'Saturday' => 'Saturday', - 'Sunday' => 'Sunday', -); - -$lang->unit_meridiem = array( - 'am' => 'am', - 'pm' => 'pm', - 'AM' => 'AM', - 'PM' => 'PM', -); - -$lang->time_gap = array( - 'min' => '%d minute ago', - 'mins' => '%d minutes ago', - 'hour' => '%d hour ago', - 'hours' => '%d hours ago', -); - -// Descriptions -$lang->about_tag = 'You may submit multiple tags by inserting commas(,) between each tag'; -$lang->about_layout = 'Layouts decorate the appearance of your modules. you can configure them from Layout menu on the top'; - -// Messages -$lang->msg_call_server = 'Requesting to the server, please wait'; -$lang->msg_db_not_setted = 'DB configuration has not been set'; -$lang->msg_dbconnect_failed = "Error has occurred while connecting DB.\nPlease check DB information again"; -$lang->msg_invalid_queryid = 'Specified query ID value is invalid'; -$lang->msg_not_permitted = 'You do not have permission to access'; -$lang->msg_input_password = 'Please input the password'; -$lang->msg_invalid_document = 'Invalid Article Number'; -$lang->msg_invalid_request = 'Invalid Request'; -$lang->msg_invalid_password = 'Invalid Password'; -$lang->msg_error_occured = 'An error has occured'; -$lang->msg_not_founded = 'Target could not be found'; -$lang->msg_no_result = 'Nothing found'; -$lang->msg_fail_to_request_open = 'Fail to open your request'; -$lang->msg_invalid_format = 'Invalid Format'; - -$lang->msg_not_permitted_act = 'You do not have permission to execute requested action'; -$lang->msg_module_does_not_exist = "Couldn't find the requested module.\nPlease contact the administrator."; -$lang->msg_module_is_not_standalone = 'Requested module cannot be executed independently'; -$lang->msg_default_url_is_not_defined = 'Default URL is not defined'; - -$lang->success_registed = 'Registered successfully'; -$lang->success_declared = 'Accused successfully'; -$lang->success_updated = 'Updated successfully'; -$lang->success_deleted = 'Deleted successfully'; -$lang->success_voted = 'Recommended successfully'; -$lang->success_blamed = 'Blamed successfully'; -$lang->success_moved = 'Moved successfully'; -$lang->success_sended = 'Sent successfully'; -$lang->success_reset = 'Reset successfully'; -$lang->success_leaved = 'All member data have been deleted completely.'; -$lang->success_saved = 'Saved successfully'; - -$lang->fail_to_delete = 'Could not be deleted'; -$lang->fail_to_move = 'Could not be moved'; - -$lang->failed_voted = 'Could not recommend'; -$lang->failed_blamed = 'Could not blame'; -$lang->failed_declared = 'Could not accuse'; -$lang->fail_to_delete_have_children = 'Please try again after removing replies first'; - -$lang->confirm_submit = 'Are you sure to submit?'; -$lang->confirm_logout = 'Are you sure to logout?'; -$lang->confirm_vote = 'Are you sure to recommend?'; -$lang->confirm_delete = 'Are you sure to delete?'; -$lang->confirm_move = 'Are you sure to move?'; -$lang->confirm_reset = 'Are you sure to reset?'; -$lang->confirm_leave = 'Are you sure to leave?'; -$lang->confirm_update = 'Are you sure to update?'; - -$lang->column_type = 'Column Type'; -$lang->column_type_list['text'] = 'one-line text'; -$lang->column_type_list['homepage'] = 'url'; -$lang->column_type_list['email_address'] = 'email'; -$lang->column_type_list['tel'] = 'phone number'; -$lang->column_type_list['textarea'] = 'multi-line textarea'; -$lang->column_type_list['checkbox'] = 'checkbox (multiple selection)'; -$lang->column_type_list['select'] = 'select box (single selection)'; -$lang->column_type_list['radio'] = 'radio button (radio)'; -$lang->column_type_list['kr_zip'] = 'zip code (Korean)'; -$lang->column_type_list['date'] = 'date (yyyy/mm/dd)'; -//$lang->column_type_list['jp_zip'] = 'zip code (Japanese)'; -$lang->column_name = 'Column Name'; -$lang->column_title = 'Column Title'; -$lang->default_value = 'Default Value'; -$lang->is_active = 'Active'; -$lang->is_required = 'Required Field'; -$lang->eid = 'Name of extra variable'; - -// ftp-related -$lang->ftp_form_title = 'FTP Account Information'; -$lang->ftp = 'FTP'; -$lang->ftp_host = 'FTP hostname'; -$lang->ftp_port = 'FTP port'; -$lang->about_ftp_password = 'FTP password will not be stored'; -$lang->cmd_check_ftp_connect = 'Check FTP Connection'; -$lang->about_ftp_info = " - FTP account information can be used in following cases.
    - 1. If safe_mode setting of PHP is on, XE will be installed using FTP.
    - 2. Automatic updates might use FTP information.
    - This account info will be stored in files/config/ftp.config.php
    - After installation, you can modify or delete the account info at the administration page.
    -"; - -$lang->msg_safe_mode_ftp_needed = "If safe_mode setting of PHP is on, you should input FTP account information to install XE."; -$lang->msg_ftp_not_connected = "Connection to localhost via FTP failed. Please check the port number and if FTP service is available."; -$lang->msg_ftp_invalid_auth_info = "Authentication failed. Please check the username and password."; -$lang->msg_ftp_mkdir_fail = "Directory creation failed. Please check the permission of FTP account."; -$lang->msg_ftp_chmod_fail = "Chmod failed. Please check the permission and configuration of FTP server."; -$lang->msg_ftp_connect_success = "Connection and authentication to the FTP server succeeded."; - -$lang->ftp_path_title = 'FTP Path Information'; -$lang->msg_ftp_installed_realpath = 'Absolute Path of XE'; -$lang->msg_ftp_installed_ftp_realpath = 'Absolute FTP Path of XE'; - -// Alert messages for Javascript using by XML filter -$lang->filter->isnull = 'Please input a value for %s'; -$lang->filter->outofrange = 'Please align the text length of %s'; -$lang->filter->equalto = "The value of %s is invalid"; -$lang->filter->invalid_email = "The format of %s is invalid. ex) developers@xpressengine.com"; -$lang->filter->invalid_user_id = $lang->filter->invalid_userid = "The format of %s is invalid.\\nAll values should consist of alphabets, numbers or underscore(_) and the first letter should be alphabet"; -$lang->filter->invalid_homepage = "The format of %s is invalid. ex) http://xpressengine.com/"; -$lang->filter->invalid_korean = "The format of %s is invalid. Please input Korean only"; -$lang->filter->invalid_korean_number = "The format of %s is invalid. Please input Korean or numbers"; -$lang->filter->invalid_alpha = "The format of %s is invalid. Please input alphabets only"; -$lang->filter->invalid_alpha_number = "The format of %s is invalid. Please input alphabets or numbers"; -$lang->filter->invalid_number = "The format of %s is invalid. Please input numbers only"; - -$lang->security_warning_embed = "Due to security concern, administrators are not allowed to view embedded items.
    To view them, please use another non-administrator ID."; -$lang->msg_pc_to_mobile = '이 페이지는 모바일 보기가 있습니다. 모바일 보기로 이동하시겠습니까?'; -?> diff --git a/tests/classes/db/classes/xml/xmlquery/queryargument/QueryArgumentTest.php b/tests/classes/db/classes/xml/xmlquery/queryargument/QueryArgumentTest.php deleted file mode 100644 index aafc07268..000000000 --- a/tests/classes/db/classes/xml/xmlquery/queryargument/QueryArgumentTest.php +++ /dev/null @@ -1,16 +0,0 @@ - */ - -/** - * Test class for QueryArgument. - */ -class QueryArgumentTest extends CubridTest { - - var $xmlPath = "data/"; - - function QueryArgumentTest(){ - $this->xmlPath = str_replace('QueryArgumentTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - } - -?> diff --git a/tests/classes/db/classes/xml/xmlquery/queryargument/data/condition1.xml b/tests/classes/db/classes/xml/xmlquery/queryargument/data/condition1.xml deleted file mode 100644 index 53decc580..000000000 --- a/tests/classes/db/classes/xml/xmlquery/queryargument/data/condition1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/queryargument/data/index1.xml b/tests/classes/db/classes/xml/xmlquery/queryargument/data/index1.xml deleted file mode 100644 index 6cbf9193a..000000000 --- a/tests/classes/db/classes/xml/xmlquery/queryargument/data/index1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/condition/ConditionTagTest.php b/tests/classes/db/classes/xml/xmlquery/tags/condition/ConditionTagTest.php deleted file mode 100644 index 97dda224b..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/condition/ConditionTagTest.php +++ /dev/null @@ -1,88 +0,0 @@ - */ - -/** - * Test class for ConditionTag. - */ -class ConditionTagTest extends CubridTest { - - var $xmlPath = "data/"; - - function ConditionTagTest(){ - $this->xmlPath = str_replace('ConditionTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - /** - * Tests a simple tag: - * - */ - function testConditionStringWithArgument(){ - $xml_file = $this->xmlPath . "condition1.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new ConditionTag($xml_obj->condition); - $arguments = $tag->getArguments(); - - $expected = "new ConditionWithArgument('\"user_id\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\")"; - $actual = $tag->getConditionString(); - $this->assertEquals($expected, $actual); - - - $this->assertEquals(1, count($arguments)); - } - - /** - * Tests a condition tag for joins - that uses no argument - * - */ - function testConditionStringWithoutArgument(){ - $xml_file = $this->xmlPath . "condition3.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new ConditionTag($xml_obj->condition); - - $expected = "new ConditionWithoutArgument('\"comments\".\"user_id\"','\"member\".\"user_id\"',\"equal\")"; - $actual = $tag->getConditionString(); - $this->assertEquals($expected, $actual); - - $arguments = $tag->getArguments(); - $this->assertEquals(0, count($arguments)); - } - - - /** - * Tests a tag with pipe: - * - */ - function testConditionStringWithPipe(){ - $xml_file = $this->xmlPath . "condition2.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new ConditionTag($xml_obj->condition); - $arguments = $tag->getArguments(); - - $expected = "new ConditionWithArgument('\"type\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\", 'and')"; - $actual = $tag->getConditionString(); - $this->assertEquals($expected, $actual); - - - $this->assertEquals(1, count($arguments)); - } - - /** - * Tests that even if the column name is given in the var attribute, it knows it's just a name and not an argument - * - */ - function testConditionStringWithoutArgumentAndDefaultValueInsideVar(){ - $xml_file = $this->xmlPath . "condition4.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new ConditionTag($xml_obj->condition); - - $expected = "new ConditionWithoutArgument('\"modules\".\"module_srl\"','\"documents\".\"module_srl\"',\"equal\", 'and')"; - $actual = $tag->getConditionString(); - $this->assertEquals($expected, $actual); - - $arguments = $tag->getArguments(); - $this->assertEquals(0, count($arguments)); - } - -} - -?> diff --git a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition1.xml b/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition1.xml deleted file mode 100644 index 274121640..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition2.xml b/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition2.xml deleted file mode 100644 index 7ace26b8d..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition3.xml b/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition3.xml deleted file mode 100644 index 538d81f3d..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition3.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition4.xml b/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition4.xml deleted file mode 100644 index ac432b118..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/condition/data/condition4.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/TableTagTest.php b/tests/classes/db/classes/xml/xmlquery/tags/table/TableTagTest.php deleted file mode 100644 index d449b65fc..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/TableTagTest.php +++ /dev/null @@ -1,133 +0,0 @@ - */ - /** - * Test class for TableTag. - */ - class TableTagTest extends CubridTest { - - var $xmlPath = "data/"; - - function TableTagTest(){ - $this->xmlPath = str_replace('TableTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - /** - * Tests a simple tag: - *
    - */ - function testTableTagWithName(){ - $xml_file = $this->xmlPath . "table_name.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TableTag($xml_obj->table); - - $expected = "new Table('\"xe_modules\"', '\"modules\"')"; - $actual = $tag->getTableString(); - $this->assertEquals($expected, $actual); - } - - /** - * Tests a
    tag with name and alias - *
    - */ - function testTableTagWithNameAndAlias(){ - $xml_file = $this->xmlPath . "table_name_alias.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $expected = "new Table('\"xe_modules\"', '\"mod\"')"; - $actual = $tag->getTableString(); - $this->assertEquals($expected, $actual); - } - - /** - * Tests a
    tag used for joins - *
    - * - * - * - *
    - * - */ - function testTableTagWithJoinCondition(){ - $xml_file = $this->xmlPath . "table_name_alias_type.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $actual = $tag->getTableString(); - - $expected = 'new JoinTable(\'"xe_module_categories"\', \'"module_categories"\', "left join", array( - new ConditionGroup(array( - new ConditionWithoutArgument(\'"module_categories"."module_category_srl"\',\'"modules"."module_category_srl"\',"equal") - )) - ))'; - $actual = Helper::cleanString($actual); - $expected = Helper::cleanString($expected); - - $this->assertEquals($expected, $actual); - } - - /** - * If a table tag has the type attribute and condition children - * it means it is meant to be used inside a join - */ - function testTagWithTypeIsJoinTable(){ - $xml_file = $this->xmlPath . "table_name_alias_type.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $this->assertEquals(true, $tag->isJoinTable()); - } - - /** - * Tests that a simple table tag is not a join table - */ - function testTagWithoutTypeIsNotJoinTable(){ - $xml_file = $this->xmlPath . "table_name_alias.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $this->assertEquals(false, $tag->isJoinTable()); - } - - /** - * If no alias is specified, test that table name is used - */ - function testTableAliasWhenAliasNotSpecified(){ - $xml_file = $this->xmlPath . "table_name.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("modules", $tag->getTableAlias()); - } - - /** - * If alias is specified, test that it is used - */ - function testTableAliasWhenAliasSpecified(){ - $xml_file = $this->xmlPath . "table_name_alias.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("mod", $tag->getTableAlias()); - } - - /** - * Table name propery should returned unescaped and unprefixed table name - * (The one in the XML file) - */ - function testTableName(){ - $xml_file = $this->xmlPath . "table_name_alias.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("modules", $tag->getTableName()); - } - - } diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/TablesTagTest.php b/tests/classes/db/classes/xml/xmlquery/tags/table/TablesTagTest.php deleted file mode 100644 index 466c22cad..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/TablesTagTest.php +++ /dev/null @@ -1,113 +0,0 @@ - */ - /** - * Test class for TablesTag. - */ - class TablesTagTest extends CubridTest { - - var $xmlPath = "data/"; - - function TablesTagTest(){ - $this->xmlPath = str_replace('TablesTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - /** - * Tests a simple tag: - * - * - * - */ - function testTablesTagWithOneTable(){ - $xml_file = $this->xmlPath . "tables_one_table.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TablesTag($xml_obj->tables); - - $expected = "array(new Table('\"xe_member\"', '\"member\"'))"; - $actual = $tag->toString(); - - $this->_testCachedOutput($expected, $actual); - } - - /** - * Tests a simple tag: - * - *
    - *
    - * - */ - function testTablesTagWithTwoTablesNoJoin(){ - $xml_file = $this->xmlPath . "tables_two_tables_no_join.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TablesTag($xml_obj->tables); - - $expected = "array( - new Table('\"xe_member_group\"', '\"a\"') - ,new Table('\"xe_member_group_member\"', '\"b\"') - )"; - $actual = $tag->toString(); - - $this->_testCachedOutput($expected, $actual); - } - - /** - * Tests a simple tag: - * - *
    - *
    - * - * - * - *
    - *
    - */ - function testTablesTagWithTwoTablesWithJoin(){ - $xml_file = $this->xmlPath . "tables_two_tables_with_join.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TablesTag($xml_obj->tables); - - $expected = "array( - new Table('\"xe_files\"', '\"files\"') - ,new JoinTable('\"xe_member\"' - , '\"member\"' - , \"left join\" - , array( - new ConditionGroup( - array( - new ConditionWithoutArgument( - '\"files\".\"member_srl\"' - ,'\"member\".\"member_srl\"' - ,\"equal\" - ) - ) - ) - ) - ) - )"; - $actual = $tag->toString(); - - $this->_testCachedOutput($expected, $actual); - } - - /** - * Tests a simple tag: - * - * - *
    - * - * - * - *
    - *
    - */ - function testGetTables(){ - $xml_file = $this->xmlPath . "tables_two_tables_with_join.xml"; - $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TablesTag($xml_obj->tables); - - $tables = $tag->getTables(); - - $this->assertEquals(2, count($tables)); - $this->assertTrue(is_a($tables[0], 'TableTag')); - $this->assertTrue(is_a($tables[1], 'TableTag')); - } - } diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name.xml deleted file mode 100644 index 6525964f0..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias.xml deleted file mode 100644 index 8240d4652..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias.xml +++ /dev/null @@ -1 +0,0 @@ -
    \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias_type.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias_type.xml deleted file mode 100644 index 6d8e7f1d5..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/table_name_alias_type.xml +++ /dev/null @@ -1,5 +0,0 @@ -
    - - - -
    \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_one_table.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_one_table.xml deleted file mode 100644 index 525df54be..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_one_table.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_no_join.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_no_join.xml deleted file mode 100644 index cdedcb831..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_no_join.xml +++ /dev/null @@ -1,4 +0,0 @@ - -
    -
    - \ No newline at end of file diff --git a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_with_join.xml b/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_with_join.xml deleted file mode 100644 index fd8d8775e..000000000 --- a/tests/classes/db/classes/xml/xmlquery/tags/table/data/tables_two_tables_with_join.xml +++ /dev/null @@ -1,8 +0,0 @@ - -
    -
    - - - -
    -
    \ No newline at end of file diff --git a/tests/classes/db/config/config.inc.php b/tests/classes/db/config/config.inc.php deleted file mode 100644 index 3d18c86c3..000000000 --- a/tests/classes/db/config/config.inc.php +++ /dev/null @@ -1,64 +0,0 @@ - */ - -error_reporting(E_ALL ^ E_NOTICE); -define('_XE_PATH_', str_replace('tests/classes/db/config/config.inc.php', '', str_replace('\\', '/', __FILE__))); -define('_TEST_PATH_', _XE_PATH_ . 'tests/classes/db/'); - -if(!defined('__DEBUG__')) define('__DEBUG__', 4); - -define('__ZBXE__', true); -define('__XE__', true); - -require_once(_TEST_PATH_.'Helper.class.php'); -require_once(_TEST_PATH_.'QueryTester.class.php'); -require_once(_TEST_PATH_.'db/DBTest.php'); -require_once(_TEST_PATH_.'db/CubridTest.php'); -require_once(_TEST_PATH_.'db/CubridOnlineTest.php'); -require_once(_TEST_PATH_.'db/MssqlTest.php'); -require_once(_TEST_PATH_.'db/MssqlOnlineTest.php'); -require_once(_TEST_PATH_.'db/MysqlTest.php'); -require_once(_TEST_PATH_.'db/SqliteTest.php'); - -require_once(_XE_PATH_.'config/config.inc.php'); -require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php'); - -require_once(_XE_PATH_.'classes/db/DB.class.php'); -require_once(_XE_PATH_.'classes/db/DBCubrid.class.php'); -require_once(_XE_PATH_.'classes/db/DBMssql.class.php'); -require_once(_XE_PATH_.'classes/db/DBMysql.class.php'); -require_once(_TEST_PATH_.'db/MockDb.php'); - -require_once(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/argument/Argument.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/argument/SortArgument.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/argument/ConditionArgument.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/DefaultValue.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/Expression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/SelectExpression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/InsertExpression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpressionWithoutArgument.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/ClickCountExpression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/Table.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/CubridTableWithHint.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/MysqlTableWithHint.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/MssqlTableWithHint.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/table/IndexHint.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionWithArgument.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionWithoutArgument.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionSubquery.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/expression/StarExpression.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/order/OrderByColumn.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/limit/Limit.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/Query.class.php'); -require_once(_XE_PATH_.'classes/db/queryparts/Subquery.class.php'); - -require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TableTag.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/HintTableTag.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionTag.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php'); -require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/SortQueryArgument.class.php'); diff --git a/tests/classes/db/db/CubridOnlineTest.php b/tests/classes/db/db/CubridOnlineTest.php deleted file mode 100644 index 0e2556368..000000000 --- a/tests/classes/db/db/CubridOnlineTest.php +++ /dev/null @@ -1,50 +0,0 @@ - */ - - /** - * Base class for tests for CUBRID SQL syntax - */ - - class CubridOnlineTest extends PHPUnit_Framework_TestCase { - - protected $backupGlobals = FALSE; - protected $backupStaticAttributes = FALSE; - protected $preserveGlobalState = FALSE; - - /** - * Prepare runtime context - tell DB class that current DB is CUBRID - */ - protected function setUp() { - $this->markTestSkipped(); - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'cubrid' - ,'db_port' => '33000' - ,'db_hostname' => '10.0.0.206' - ,'db_userid' => 'dba' - ,'db_password' => 'arniarules' - ,'db_database' => 'xe15QA' - ,'db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'cubrid' - ,'db_port' => '33000' - ,'db_hostname' => '10.0.0.206' - ,'db_userid' => 'dba' - ,'db_password' => 'arniarules' - ,'db_database' => 'xe15QA' - ,'db_table_prefix' => 'xe_')); - $oContext->setDbInfo($db_info); - - // remove cache dir - FileHandler::removeDir( _XE_PATH_ . 'files/cache'); - - DB::getParser(true); - } - - /** - * Free resources - reset static DB and QueryParser - */ - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/CubridTest.php b/tests/classes/db/db/CubridTest.php deleted file mode 100644 index dd02378c6..000000000 --- a/tests/classes/db/db/CubridTest.php +++ /dev/null @@ -1,32 +0,0 @@ - */ - - /** - * Base class for tests for CUBRID SQL syntax - */ - - class CubridTest extends DBTest { - - /** - * Prepare runtime context - tell DB class that current DB is CUBRID - */ - protected function setUp() { - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'cubrid','db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'cubrid','db_table_prefix' => 'xe_')); - - $oContext->setDbInfo($db_info); - - $db = new MockDb(); - $db->getParser(true); - } - - /** - * Free resources - reset static DB and QueryParser - */ - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/DBTest.php b/tests/classes/db/db/DBTest.php deleted file mode 100644 index cdc9e9f83..000000000 --- a/tests/classes/db/db/DBTest.php +++ /dev/null @@ -1,75 +0,0 @@ - */ - -class DBTest extends PHPUnit_Framework_TestCase { - - function _testQuery($xml_file, $argsString, $expected, $methodName, $columnList = null){ - echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL; - echo $xml_file; - echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL; - - $tester = new QueryTester(); - $outputString = $tester->getNewParserOutputString($xml_file, $argsString); - echo $outputString; - $output = eval($outputString); - - if(!is_a($output, 'Query')){ - if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; - }else { - $db = &DB::getInstance(); - if($columnList) $output->setColumnList($columnList); - $querySql = $db->{$methodName}($output); - - // Remove whitespaces, tabs and all - if(is_a($querySql, 'Object')) - { - $querySql = $querySql->getMessage(); - } - $querySql = Helper::cleanString($querySql); - $expected = Helper::cleanString($expected); - } - $this->assertEquals($expected, $querySql); - } - - function _testPreparedQuery($xml_file, $argsString, $expected, $methodName, $expectedArgs = NULL){ - echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL; - echo $xml_file; - echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL; - - $tester = new QueryTester(); - $outputString = $tester->getNewParserOutputString($xml_file, $argsString); - echo $outputString; - $output = eval($outputString); - - if(!is_a($output, 'Query')){ - if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; - }else { - $db = &DB::getInstance(); - $querySql = $db->{$methodName}($output, false); - $queryArguments = $output->getArguments(); - - // Remove whitespaces, tabs and all - $querySql = Helper::cleanString($querySql); - $expected = Helper::cleanString($expected); - } - - // Test - $this->assertEquals($expected, $querySql); - - // Test query arguments - $argCount = count($expectedArgs); - for($i = 0; $i < $argCount; $i++){ - $this->assertEquals($expectedArgs[$i], $queryArguments[$i]->getEscapedValue()); - } - } - - function _testCachedOutput($expected, $actual){ - $expected = Helper::cleanString($expected); - $actual = Helper::cleanString($actual); - - $this->assertEquals($expected, $actual); - - } - } - -?> diff --git a/tests/classes/db/db/ExpressionParserTest.php b/tests/classes/db/db/ExpressionParserTest.php deleted file mode 100644 index b48feef46..000000000 --- a/tests/classes/db/db/ExpressionParserTest.php +++ /dev/null @@ -1,110 +0,0 @@ - */ - - class ExpressionParserTest extends PHPUnit_Framework_TestCase { - /* Escape char for: - * CUBRID "" - * MySql `` - * SqlServer [] - */ - var $dbLeftEscapeChar = '['; - var $dbRightEscapeChar = ']'; - - function _test($column_name, $alias, $expected){ - $expressionParser = new DBParser($this->dbLeftEscapeChar,$this->dbRightEscapeChar); - $actual = $expressionParser->parseExpression($column_name); - if($alias) $actual .= " as $alias"; - $this->assertEquals($expected, $actual); - } - - function testStarExpressionIsNotEscaped(){ - $this->_test("*", NULL, '*'); - } - - function testSimpleColumnNameGetsEscaped(){ - $this->_test("member_srl", NULL - , $this->dbLeftEscapeChar.'member_srl'.$this->dbRightEscapeChar ); - } - - function testUnqualifiedAliasedColumnNameGetsEscaped(){ - $this->_test("member_srl", "id" - , $this->dbLeftEscapeChar.'member_srl'.$this->dbRightEscapeChar.' as id'); - } - - function testQualifiedColumnNameGetsEscaped(){ - $this->_test("xe_members.member_srl", NULL - , $this->dbLeftEscapeChar.'xe_members'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'member_srl'.$this->dbRightEscapeChar); - } - - function testQualifiedAliasedColumnNameGetsEscaped(){ - $this->_test("xe_members.member_srl","id" - ,$this->dbLeftEscapeChar.'xe_members'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'member_srl'.$this->dbRightEscapeChar.' as id'); - } - - function testCountDoesntGetEscaped(){ - $this->_test("count(*)", NULL, 'count(*)'); - } - - function testAliasedCountDoesntGetEscaped(){ - $this->_test("count(*)", "count", 'count(*) as count'); - } - - function testUnqualifiedColumnExpressionWithOneParameterLessFunction(){ - $this->_test("substring(regdate)", NULL - , 'substring('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.')'); - } - - function testAliasedUnqualifiedColumnExpressionWithOneParameterLessFunction(){ - $this->_test("substring(regdate)", "regdate" - , 'substring('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.') as regdate'); - } - - function testQualifiedColumnExpressionWithOneParameterLessFunction(){ - $this->_test("substring(xe_member.regdate)", NULL - , 'substring('.$this->dbLeftEscapeChar.'xe_member'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.')'); - } - - function testAliasedQualifiedColumnExpressionWithOneParameterLessFunction(){ - $this->_test("substring(xe_member.regdate)", "regdate" - , 'substring('.$this->dbLeftEscapeChar.'xe_member'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.') as regdate'); - } - - function testUnqualifiedColumnExpressionWithTwoParameterLessFunctions(){ - $this->_test("lpad(rpad(regdate))", NULL - , 'lpad(rpad('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.'))'); - } - - function testAliasedUnqualifiedColumnExpressionWithTwoParameterLessFunctions(){ - $this->_test("lpad(rpad(regdate))", "regdate" - , 'lpad(rpad('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.')) as regdate'); - } - - function testQualifiedColumnExpressionWithTwoParameterLessFunctions(){ - $this->_test("lpad(rpad(xe_member.regdate))", NULL - , 'lpad(rpad('.$this->dbLeftEscapeChar.'xe_member'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.'))'); - } - - function testAliasedQualifiedColumnExpressionWithTwoParameterLessFunctions(){ - $this->_test("lpad(rpad(xe_member.regdate))", "regdate" - , 'lpad(rpad('.$this->dbLeftEscapeChar.'xe_member'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.')) as regdate'); - } - - function testColumnAddition(){ - $this->_test("score1 + score2", "total" - , $this->dbLeftEscapeChar.'score1'.$this->dbRightEscapeChar.' + '.$this->dbLeftEscapeChar.'score2'.$this->dbRightEscapeChar.' as total'); - } - - function testMultipleParameterFunction(){ - $this->_test("substring(regdate, 1, 8)", NULL - , 'substring('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.', 1, 8)'); - $this->_test("substring(regdate, 1, 8)", "regdate" - , 'substring('.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.', 1, 8) as regdate'); - $this->_test("substring(xe_member.regdate, 1, 8)", NULL - , 'substring('.$this->dbLeftEscapeChar.'xe_member'.$this->dbRightEscapeChar.'.'.$this->dbLeftEscapeChar.'regdate'.$this->dbRightEscapeChar.', 1, 8)'); - } - - function testFunctionAddition(){ - $this->_test("abs(score) + abs(totalscore)", NULL - , 'abs('.$this->dbLeftEscapeChar.'score'.$this->dbRightEscapeChar.') + abs('.$this->dbLeftEscapeChar.'totalscore'.$this->dbRightEscapeChar.')'); - } - } diff --git a/tests/classes/db/db/MockDb.php b/tests/classes/db/db/MockDb.php deleted file mode 100644 index 009dbff21..000000000 --- a/tests/classes/db/db/MockDb.php +++ /dev/null @@ -1,82 +0,0 @@ - */ - - /** - * @brief Mock database base class - * - * Used to load mock classes instead of actual ones, - * so that connect methods can be skipped - */ - class MockDb extends DB { - - function &getParser($force = false){ - static $dbParser = null; - if(!$dbParser || $force) { - $oDB = &MockDb::getInstance(); - $dbParser = $oDB->getParser(); - DB::getParser(true); - } - - return $dbParser; - } - - function &getInstance(){ - $db_type = Context::getDBType(); - - if(!isset($GLOBALS['__DB__'])) $GLOBALS['__DB__'] = array(); - if(!isset($GLOBALS['__DB__'][$db_type])) { - switch($db_type){ - case 'mssql' : - $GLOBALS['__DB__'][$db_type] = new MockDBMssql; break; - case 'mysql' : - $GLOBALS['__DB__'][$db_type] = new MockDBMysql; break; - case 'cubrid' : - $GLOBALS['__DB__'][$db_type] = new MockDBCubrid; break; - } - } - - return $GLOBALS['__DB__'][$db_type]; - } - } - - /** - * @brief Mock up for MS SQL class - * - * Overrides default constructor in order to skip connect method - */ - class MockDBMssql extends DBMssql { - function MockDBMssql(){ - $this->_setDBInfo(); - } - } - - /** - * @brief Mock up for CUBRID class - * - * Overrides default constructor in order to skip connect method - */ - class MockDBCubrid extends DBCubrid { - function MockDBCubrid(){ - $this->_setDBInfo(); - } - } - - /** - * @brief Mock up for Mysql class - * - * Overri des default constructor in order to skip connect method. - */ - class MockDBMysql extends DBMysql { - function MockDBMysql(){ - $this->_setDBInfo(); - } - - /** - * Overrides mysql_real_escape_string, that returns null when no connection is present - */ - function addQuotes($string){ - return $string; - } - } - -?> diff --git a/tests/classes/db/db/MssqlOnlineTest.php b/tests/classes/db/db/MssqlOnlineTest.php deleted file mode 100644 index 497f6e1a7..000000000 --- a/tests/classes/db/db/MssqlOnlineTest.php +++ /dev/null @@ -1,50 +0,0 @@ - */ - - /** - * Base class for tests for MSSQL SQL syntax - */ - - class MssqlOnlineTest extends PHPUnit_Framework_TestCase { - - protected $backupGlobals = FALSE; - protected $backupStaticAttributes = FALSE; - protected $preserveGlobalState = FALSE; - - /** - * Prepare runtime context - tell DB class that current DB is MSSQL - */ - protected function setUp() { - $this->markTestSkipped(); - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'mssql' - ,'db_port' => '3306' - ,'db_hostname' => 'PHENOMII\SQL2008EXPRESS' - ,'db_userid' => 'dba' - ,'db_password' => 'arniarules' - ,'db_database' => 'xe-15-db' - ,'db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'mssql' - ,'db_port' => '3306' - ,'db_hostname' => 'PHENOMII\SQL2008EXPRESS' - ,'db_userid' => 'dba' - ,'db_password' => 'arniarules' - ,'db_database' => 'xe-15-db' - ,'db_table_prefix' => 'xe_')); - $oContext->setDbInfo($db_info); - - // remove cache dir - FileHandler::removeDir( _XE_PATH_ . 'files/cache'); - - DB::getParser(true); - } - - /** - * Free resources - reset static DB and QueryParser - */ - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/MssqlTest.php b/tests/classes/db/db/MssqlTest.php deleted file mode 100644 index 1f09ed99b..000000000 --- a/tests/classes/db/db/MssqlTest.php +++ /dev/null @@ -1,27 +0,0 @@ - */ - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - - class MssqlTest extends DBTest { - - protected function setUp() { - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'mssql','db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'mssql','db_table_prefix' => 'xe_')); - - $oContext->setDbInfo($db_info); - - $db = new MockDb(); - $db->getParser(true); - } - - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/MysqlTest.php b/tests/classes/db/db/MysqlTest.php deleted file mode 100644 index c78e857b3..000000000 --- a/tests/classes/db/db/MysqlTest.php +++ /dev/null @@ -1,32 +0,0 @@ - */ - - /** - * Base class for tests for Mysql SQL syntax - */ - - class MysqlTest extends DBTest { - - /** - * Prepare runtime context - tell DB class that current DB is CUBRID - */ - protected function setUp() { - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'mysql','db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'mysql','db_table_prefix' => 'xe_')); - - $oContext->setDbInfo($db_info); - - $db = new MockDb(); - $db->getParser(true); - } - - /** - * Free resources - reset static DB and QueryParser - */ - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/SqliteTest.php b/tests/classes/db/db/SqliteTest.php deleted file mode 100644 index b1916b921..000000000 --- a/tests/classes/db/db/SqliteTest.php +++ /dev/null @@ -1,33 +0,0 @@ - */ - - /** - * Base class for tests for Sqlite SQL syntax - * - * See syntax reference: - * http://www.sqlite.org/lang.html - */ - - class SqliteTest extends DBTest { - - /** - * Prepare runtime context - tell DB class that current DB is CUBRID - */ - protected function setUp() { - $oContext = &Context::getInstance(); - - $db_info->master_db = array('db_type' => 'sqlite3_pdo','db_table_prefix' => 'xe_'); - $db_info->slave_db = array(array('db_type' => 'sqlite3_pdo','db_table_prefix' => 'xe_')); - - $oContext->setDbInfo($db_info); - DB::getParser(true); - } - - /** - * Free resources - reset static DB and QueryParser - */ - protected function tearDown() { - unset($GLOBALS['__DB__']); - } - } -?> diff --git a/tests/classes/db/db/xml_query/cubrid/CubridDeleteTest.php b/tests/classes/db/db/xml_query/cubrid/CubridDeleteTest.php deleted file mode 100644 index 0e9bc8ec1..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridDeleteTest.php +++ /dev/null @@ -1,21 +0,0 @@ - */ - - class CubridDeleteTest extends CubridTest { - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getDeleteSql'); - } - - function test_module_deleteActionForward(){ - $xml_file = _XE_PATH_ . "modules/module/queries/deleteActionForward.xml"; - $argsString = '$args->module = "page"; - $args->type = "page"; - $args->act = "tata";'; - $expected = 'delete "action_forward" from "xe_action_forward" as "action_forward" - where "module" = \'page\' - and "type" = \'page\' - and "act" = \'tata\''; - $this->_test($xml_file, $argsString, $expected); - } - } diff --git a/tests/classes/db/db/xml_query/cubrid/CubridIndexHintTest.php b/tests/classes/db/db/xml_query/cubrid/CubridIndexHintTest.php deleted file mode 100644 index 78552090a..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridIndexHintTest.php +++ /dev/null @@ -1,86 +0,0 @@ - */ - - class CubridIndexHintTest extends CubridTest { - var $xmlPath = 'data/'; - - function CubridIndexHintTest(){ - $this->xmlPath = str_replace('CubridIndexHintTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - function _test($xml_file, $argsString, $expected){ - var_dump($xml_file); - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql'); - } - - function testOneUseIndexHintAndOneTable(){ - $xml_file = $this->xmlPath . "one_index_hint_one_table.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member" using index "member"."xe_idx_member_list_order"'; - $this->_test($xml_file, $argsString, $expected); - } - - - function testTwoUseIndexHintsAndOneTable(){ - $xml_file = $this->xmlPath . "two_index_hints_one_table.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member" using index "member"."xe_idx_member_list_order", "member"."xe_idx_member_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testThreeUseIndexHintsAndTwoTables(){ - $xml_file = $this->xmlPath . "three_index_hints_two_tables.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member", "xe_document" as "document" - using index "member"."xe_idx_member_list_order", "member"."xe_idx_member_srl", "document"."xe_idx_document_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testThreeUseIndexHintsAndTwoTablesCombined(){ - $xml_file = $this->xmlPath . "three_index_hints_two_tables_combined.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member", "xe_document" as "document" - using index "member"."xe_idx_member_list_order", "member"."xe_idx_member_srl"(+), "document"."xe_idx_document_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testIgnoreIndexHintIsSkipped(){ - $xml_file = $this->xmlPath . "ignore_index_hint.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testMysqlIndexHintIsSkipped(){ - $xml_file = $this->xmlPath . "mysql_index_hint.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member"'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * If CUBRID database is used, indexes are created with prefix. - * - * e.g.: xe_indx_list_order - */ - function testPrefixIsAddedToIndexName(){ - $xml_file = $this->xmlPath . "one_index_hint_one_table.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member" using index "member"."xe_idx_member_list_order"'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Tests that index is added if "for" attribute is "ALL" - * - * example: ... - */ - function testIndexHintForAll(){ - $xml_file = $this->xmlPath . "index_hint_for_all.xml"; - $argsString = ''; - $expected = 'select * from "xe_member" as "member" using index "member"."xe_idx_member_list_order"'; - $this->_test($xml_file, $argsString, $expected); - } - - } -?> diff --git a/tests/classes/db/db/xml_query/cubrid/CubridInsertOnlineTest.php b/tests/classes/db/db/xml_query/cubrid/CubridInsertOnlineTest.php deleted file mode 100644 index 5ce67752e..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridInsertOnlineTest.php +++ /dev/null @@ -1,86 +0,0 @@ - */ - - class CubridInsertOnlineTest extends CubridOnlineTest { - - /** - * Note: this test can fail when comaparing regdate from the $args with - * regdate from the expected string - a few seconds difference - */ - function test_module_insertModule_escapeContent(){ - $xml_file = _XE_PATH_ . "modules/module/queries/insertModule.xml"; - - $args->module_category_srl = 0; - $args->browser_title = "test"; - $args->layout_srl = 0; - $args->mlayout_srl = 0; - $args->module = "page"; - $args->mid = "test"; - $args->site_srl = 0; - $args->module_srl = 47374; - $args->content = "hello \' moto"; - - $output = executeQuery('module.insertModule', $args); - - $this->assertTrue(!$output->error, $output->message); - } - - function test_document_insertDocument_defaultVarcharValue(){ - $args->module_srl = 102; - $args->content = '

    yuhuuuuu

    '; - $args->document_srl = 9200; - $args->is_secret = 'N'; - $args->allow_comment = 'N'; - $args->lock_comment = 'N'; - $args->allow_trackback = 'N'; - $args->notify_message = 'N'; - $args->ipaddress = '127.0.0.1'; - $args->extra_vars = 'N;'; - $args->readed_count = 0; - $args->list_order = -9201; - $args->update_order = -9201; - $args->member_srl = 4; - $args->user_id = 'admin'; - $args->user_name = 'admin'; - $args->nick_name = 'admin'; - $args->email_address = 'admin@admin.admin'; - $args->homepage = ''; - $args->title = 'yuhuu'; - $args->lang_code; - $output = executeQuery('document.insertDocument', $args); - - $this->assertNotEquals(-225, $output->error); - $this->assertNotEquals('Missing value for attribute "homepage" with the NOT NULL constraint.', $output->message); - } - - function test_communication_addFriendGroup(){ - $args->member_srl = 202; - $args->title = "Grup"; - - $output = executeQuery("communication.addFriendGroup", $args); - $this->assertEquals(0, $output->error, $output->message); - - } - - function test_communication_addFriendGroup_NullId(){ - $args->member_srl = 202; - $args->title = "Grup"; - $args->friend_group_srl = trim(null); - - $output = executeQuery("communication.addFriendGroup", $args); - $this->assertEquals(0, $output->error, $output->message); - - } - - protected function tearDown() { - $db = &DB::getInstance(); - $db->_query("DELETE FROM xe_modules WHERE module_srl = 47374"); - $db->_query("DELETE FROM xe_documents WHERE document_srl = 9200"); - $db->_query("DELETE FROM xe_member_friend_group WHERE member_srl = 202"); - $db->close(); - - parent::tearDown(); - } - - - } diff --git a/tests/classes/db/db/xml_query/cubrid/CubridInsertTest.php b/tests/classes/db/db/xml_query/cubrid/CubridInsertTest.php deleted file mode 100644 index 204726450..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridInsertTest.php +++ /dev/null @@ -1,128 +0,0 @@ - */ - - class CubridInsertTest extends CubridTest { - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getInsertSql'); - } - - - /** - * Note: this test can fail when comaparing regdate from the $args with - * regdate from the expected string - a few seconds difference - */ - function test_module_insertModule(){ - $xml_file = _XE_PATH_ . "modules/module/queries/insertModule.xml"; - $argsString = ' $args->module_category_srl = 0; - $args->browser_title = "test"; - $args->layout_srl = 0; - $args->mlayout_srl = 0; - $args->module = "page"; - $args->mid = "test"; - $args->site_srl = 0; - $args->module_srl = 47374;'; - $expected = 'insert into "xe_modules" - ("site_srl" - , "module_srl" - , "module_category_srl" - , "mid" - , "browser_title" - , "layout_srl" - , "module" - , "is_default" - , "open_rss" - , "regdate" - , "mlayout_srl" - , "use_mobile") - values - (0 - , 47374 - , 0 - , \'test\' - , \'test\' - , 0 - , \'page\' - , \'n\' - , \'y\' - , \''.date("YmdHis").'\' - , 0 - , \'n\')'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_insertSiteTodayStatus(){ - //\''.date("YmdHis").'\' - $xml_file = _XE_PATH_ . "modules/counter/queries/insertTodayStatus.xml"; - $argsString = ' $args->regdate = 0; - $args->unique_visitor = 0; - $args->pageview = 0;'; - $expected = 'insert into "xe_counter_status" - ("regdate" - , "unique_visitor" - , "pageview") - values - ('.date("YmdHis").' - , 0 - , 0)'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_insertCounterLog(){ - $xml_file = _XE_PATH_ . "modules/counter/queries/insertCounterLog.xml"; - $argsString = ' $args->site_srl = 0; - $args->regdate = "20110607120619"; - $args->ipaddress = "127.0.0.1"; - $args->user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24";'; - $expected = 'insert into "xe_counter_log" - ("site_srl", "regdate", "ipaddress", "user_agent") - VALUES (0, \'20110607120619\', \'127.0.0.1\', \'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24\') - '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_insertMember(){ - $xml_file = _XE_PATH_ . "modules/member/queries/insertMember.xml"; - $argsString = ' $args->member_srl = 203; - $args->user_id = "cacao"; - $args->email_address = "teta@ar.ro"; - $args->password = "23e5484cb88f3c07bcce2920a5e6a2a7"; - $args->email_id = "teta"; - $args->email_host = "ar.ro"; - $args->user_name = "trident"; - $args->nick_name = "aloha"; - $args->homepage = "http://jkgjfk./ww"; - $args->allow_mailing = "Y"; - $args->allow_message = "Y"; - $args->denied = "N"; - $args->regdate = "20110607121952"; - $args->change_password_date = "20110607121952"; - $args->last_login = "20110607121952"; - $args->is_admin = "N"; - $args->extra_vars = "O:8:\"stdClass\":2:{s:4:\"body\";s:0:\"\";s:7:\"_filter\";s:6:\"insert\";}"; - $args->list_order = -203; - '; - $expected = 'INSERT INTO "xe_member" - ("member_srl", "user_id", "email_address", "password", "email_id", "email_host", "user_name", "nick_name", - "homepage", "allow_mailing", "allow_message", "denied", "regdate", "change_password_date", - "last_login", "is_admin", "extra_vars", "list_order") - VALUES (203, \'cacao\', \'teta@ar.ro\', \'23e5484cb88f3c07bcce2920a5e6a2a7\', \'teta\', \'ar.ro\', \'trident\', - \'aloha\', \'http://jkgjfk./ww\', \'Y\', \'Y\', \'N\', \'20110607121952\', \'20110607121952\', - \'20110607121952\', \'N\', \'O:8:"stdClass":2:{s:4:"body";s:0:"";s:7:"_filter";s:6:"insert";}\', -203)'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_insertModuleExtraVars(){ - $xml_file = _XE_PATH_ . "modules/module/queries/insertModuleExtraVars.xml"; - $argsString = ' $args->module_srl = 202; - $args->name = "_filter"; - $args->value = "insert_page"; - '; - $expected = 'INSERT INTO "xe_module_extra_vars" - ("module_srl", "name", "value") - VALUES (202, \'_filter\', \'insert_page\') - '; - $this->_test($xml_file, $argsString, $expected); - } - - } diff --git a/tests/classes/db/db/xml_query/cubrid/CubridSelectOnlineTest.php b/tests/classes/db/db/xml_query/cubrid/CubridSelectOnlineTest.php deleted file mode 100644 index 6d4abb679..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridSelectOnlineTest.php +++ /dev/null @@ -1,77 +0,0 @@ - */ - - class CubridSelectOnlineTest extends CubridOnlineTest { - - function test_get_module_by_mid(){ - $args->mid = 'test_4l8ci4vv0n'; - $args->site_srl = 0; - $output = executeQuery('module.getMidInfo', $args); - $this->assertNotNull($output); - $this->assertNotNull($output->data, $output->message . PHP_EOL . $output->variables["_query"]); - $this->assertEquals($output->data->module_srl, 111); - } - - /** - * Tests that when a column list is given, the query only selects those columns from the database - * insetad of retrieving all table columns (as specified in the xml query file) - */ - function test_get_module_by_mid_columnList(){ - $args->mid = 'test_4l8ci4vv0n'; - $args->site_srl = 0; - $output = executeQuery('module.getMidInfo', $args, array('module_srl')); - $this->assertNotNull($output); - $this->assertNotNull($output->data, $output->message . PHP_EOL . $output->variables["_query"]); - $this->assertEquals($output->data->module_srl, 111); - $this->assertEquals($output->data->module, null); - } - - function test_module_getInfo(){ - $args->site_srl = 0; - $output = executeQuery('module.getSiteInfo', $args); - $this->assertTrue(is_a($output, 'Object')); - $this->assertEquals(0, $output->error, $output->message . PHP_EOL . $output->variables["_query"]); - } - - function test_document_getDocumentList_pagination(){ - $args->sort_index = 'list_order'; - $args->order_type = 'asc'; - $args->page = 1; - $args->list_count = 30; - $args->page_count = 10; - $args->s_member_srl = 4; - - $output = executeQuery('document.getDocumentList', $args); - $this->assertEquals(0, $output->error, $output->message . PHP_EOL . $output->variables["_query"]); - } - - function test_syndication_getDocumentList(){ - $args->module_srl = NULL; - $args->exclude_module_srl = NULL; - $args->category_srl = NULL; - $args->sort_index = 'list_order'; - $args->order_type = 'asc'; - $args->page = 5; - $args->list_count = 30; - $args->page_count = 10; - $args->start_date = NULL; - $args->end_date = NULL; - $args->member_srl = NULL; - $output = executeQuery('document.getDocumentList', $args); - - $this->assertTrue(is_int($output->page), $output->message . PHP_EOL . $output->variables["_query"]); - } - - function test_member_getMemberList(){ - $args->is_admin = ''; - $args->is_denied = ''; - $args->sort_index = "list_order"; - $args->sort_order = 'asc'; - $args->list_count = 40; - $args->page_count = 10; - - $output = executeQuery('member.getMemberList', $args); - $this->assertEquals(0, $output->error, $output->message . PHP_EOL . $output->variables["_query"]); - } - } -?> diff --git a/tests/classes/db/db/xml_query/cubrid/CubridSelectTest.php b/tests/classes/db/db/xml_query/cubrid/CubridSelectTest.php deleted file mode 100644 index bd439956f..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridSelectTest.php +++ /dev/null @@ -1,456 +0,0 @@ - */ - - class CubridSelectTest extends CubridTest { - - function _test($xml_file, $argsString, $expected, $columnList = null){ - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql', $columnList); - } - - function testSelectStar(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml"; - $argsString = '$args->module_srl = 10;'; - $expected = 'SELECT * FROM "xe_module_admins" as "module_admins" , "xe_member" as "member" WHERE "module_srl" = 10 and "member"."member_srl" = "module_admins"."member_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testRequiredParameter(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml"; - $argsString = ''; - $expected = 'Date incorecte! Query-ul nu a putut fi executat.'; - $this->_test($xml_file, $argsString, $expected); - } - - function testWithoutCategoriesTag(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleCategories.xml"; - $argsString = ''; - $expected = 'SELECT * FROM "xe_module_categories" as "module_categories" ORDER BY "title" asc'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getDefaultModules(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getDefaultModules.xml"; - $argsString = '$args->site_srl = 0;'; - $expected = 'SELECT "modules"."site_srl" - , "modules"."module" - , "modules"."mid" - , "modules"."browser_title" - , "module_categories"."title" as "category" - , "modules"."module_srl" - FROM "xe_modules" as "modules" - left join "xe_module_categories" as "module_categories" - on "module_categories"."module_category_srl" = "modules"."module_category_srl" - WHERE "modules"."site_srl" = 0 - ORDER BY "modules"."module" asc, "module_categories"."title" asc, "modules"."mid" asc'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getSiteInfo(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getSiteInfo.xml"; - $argsString = '$args->site_srl = 0;'; - $expected = 'SELECT "modules"."site_srl" as "module_site_srl" - , "modules"."module_srl" as "module_srl" - , "modules"."module" as "module" - , "modules"."module_category_srl" as "module_category_srl" - , "modules"."layout_srl" as "layout_srl" - , "modules"."mlayout_srl" as "mlayout_srl" - , "modules"."use_mobile" as "use_mobile" - , "modules"."menu_srl" as "menu_srl" - , "modules"."mid" as "mid" - , "modules"."skin" as "skin" - , "modules"."mskin" as "mskin" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - , "modules"."is_default" as "is_default" - , "modules"."content" as "content" - , "modules"."mcontent" as "mcontent" - , "modules"."open_rss" as "open_rss" - , "modules"."header_text" as "header_text" - , "modules"."footer_text" as "footer_text" - , "modules"."regdate" as "regdate" - , "sites"."site_srl" as "site_srl" - , "sites"."domain" as "domain" - , "sites"."index_module_srl" as "index_module_srl" - , "sites"."default_language" as "default_language" - FROM "xe_sites" as "sites" - left join "xe_modules" as "modules" on "modules"."module_srl" = "sites"."index_module_srl" - WHERE "sites"."site_srl" = 0 '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_addon_getAddonInfo(){ - $xml_file = _XE_PATH_ . "modules/addon/queries/getAddonInfo.xml"; - $argsString = '$args->addon = "captcha";'; - $expected = 'SELECT * - FROM "xe_addons" as "addons" - WHERE "addon" = \'captcha\' '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_addon_getAddons(){ - $xml_file = _XE_PATH_ . "modules/addon/queries/getAddons.xml"; - $argsString = ''; - $expected = 'SELECT * - FROM "xe_addons" as "addons" - ORDER BY "addon" asc'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_admin_getCommentCount(){ - $xml_file = _XE_PATH_ . "modules/admin/queries/getCommentCount.xml"; - $argsString = ''; - $expected = 'SELECT count(*) as "count" - FROM "xe_comments" as "comments"'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_admin_getCommentDeclaredStatus(){ - $xml_file = _XE_PATH_ . "modules/admin/queries/getCommentDeclaredStatus.xml"; - $argsString = '$args->date = "20110411";'; - $expected = 'SELECT substr("regdate",1,8) as "date", count(*) as "count" - FROM "xe_comment_declared_log" as "comment_declared_log" - WHERE "regdate" >= \'20110411\' - GROUP BY substr("regdate",1,8) - ORDER BY substr("regdate",1,8) asc limit 2'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_member_getAutoLogin(){ - $xml_file = _XE_PATH_ . "modules/member/queries/getAutoLogin.xml"; - $argsString = '$args->autologin_key = 10;'; - $expected = 'SELECT "member"."user_id" as "user_id" - , "member"."password" as "password" - , "member_autologin"."autologin_key" as "autologin_key" - FROM "xe_member" as "member" , "xe_member_autologin" as "member_autologin" - WHERE "member_autologin"."autologin_key" = \'10\' - and "member"."member_srl" = "member_autologin"."member_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_opage_getOpageList(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/opage.getOpageList.xml"; - $argsString = '$args->s_title = "yuhuu"; - $args->module = \'opage\';'; - $expected = 'SELECT * - FROM "xe_modules" as "modules" - WHERE "module" = \'opage\' and ("title" like \'%yuhuu%\') - ORDER BY "module_srl" desc - LIMIT 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_syndication_getGrantedModules(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getGrantedModules.xml"; - $argsString = '$args->module_srl = 12; - $args->name = array(\'access\',\'view\',\'list\');'; - $expected = 'select "module_srl" - from "xe_module_grants" as "module_grants" - where "name" in (\'access\',\'view\',\'list\') - and ("group_srl" >= 1 - or "group_srl" = -1 - or "group_srl" = -2) - group by "module_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_document_getDocumentList(){ - $xml_file = _XE_PATH_ . "modules/document/queries/getDocumentList.xml"; - $argsString = '$args->sort_index = \'list_order\'; - $args->order_type = \'asc\'; - $args->page = 1; - $args->list_count = 30; - $args->page_count = 10; - $args->s_member_srl = 4;'; - $expected = 'select * - from "xe_documents" as "documents" - where ("member_srl" = 4) - and "list_order" <= 2100000000 - order by "list_order" asc - limit 0, 30'; - $this->_test($xml_file, $argsString, $expected); - - - } - - /** - * Test column list - */ - function test_session_getSession(){ - $xml_file = _XE_PATH_ . "modules/session/queries/getSession.xml"; - $argsString = '$args->session_key = \'session_key\';'; - $columnList = array('session_key', 'cur_mid', 'val'); - - $expected = 'select "session_key", "cur_mid", "val" - from "xe_session" as "session" - where "session_key" = \'session_key\''; - - $this->_test($xml_file, $argsString, $expected, $columnList); - } - - function test_module_getModuleInfoByDocument(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleInfoByDocument.xml"; - $argsString = '$args->document_srl = 10;'; - $expected = 'SELECT "modules".* - FROM "xe_modules" as "modules" - , "xe_documents" as "documents" - WHERE "documents"."document_srl" = 10 - and "modules"."module_srl" = "documents"."module_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_member_getMemberList(){ - $xml_file = _XE_PATH_ . "modules/member/queries/getMemberList.xml"; - $argsString = '$args->is_admin = \'\'; - $args->is_denied = \'\'; - $args->sort_index = "list_order"; - $args->sort_order = \'asc\'; - $args->list_count = 40; - $args->page_count = 10;'; - $expected = 'select * - from "xe_member" as "member" - where "list_order" <= 2100000000 - order by "list_order" asc - limit 0, 40'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Tests "not in" query condition - * Query argument is a single value - not in (12) - */ - function test_module_getModules_Notin_Single_Value(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->except_module_srls = 12;'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" not in (12) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModules_Notin_Multiple_Value_String(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->except_module_srls = "12, 13, 14";'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" not in (12,13,14) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModules_Notin_Multiple_Value_Array(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->except_module_srls = array(12, 13, 14);'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" not in (12,13,14) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModules_In_Single_Value(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->module_srls = 12;'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" in (12) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModules_In_Multiple_Value_String(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->module_srls = "12, 13, 14";'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" in (12,13,14) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModules_In_Multiple_Value_Array(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; - $argsString = '$args->module_srls = array(12, 13, 14);'; - $expected = 'select "modules"."site_srl" as "site_srl" - , "modules"."module_srl" as "module_srl" - , "sites"."domain" as "domain" - , "modules"."mid" as "mid" - , "modules"."module" as "module" - , "modules"."browser_title" as "browser_title" - , "modules"."description" as "description" - from "xe_sites" as "sites" - , "xe_modules" as "modules" - left join "xe_syndication_except_modules" as "except_modules" - on "modules"."module_srl" = "except_modules"."module_srl" - where "modules"."module_srl" in (12,13,14) - and "sites"."site_srl" = "modules"."site_srl" - and "except_modules"."module_srl" is null'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getModuleSrlByMid_In_Multiple_Value_Array_Strings(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleSrlByMid.xml"; - $argsString = '$args->mid = "\'mid1\', \'mid2\'";'; - $expected = 'select "module_srl" from "xe_modules" as "modules" where "mid" in (\'mid1\',\'mid2\')'; - $this->_test($xml_file, $argsString, $expected); - } - - - function test_file_getFileList_In_Empty_Array_Value(){ - $xml_file = _XE_PATH_ . "modules/file/queries/getFileList.xml"; - $argsString = '$args->exclude_module_srl = 12; $args->s_module_srl = array(); '; - $expected = 'select "files".* - from "xe_files" as "files" - left join "xe_member" as "member" on "files"."member_srl" = "member"."member_srl" - where "files"."module_srl" not in (12) - order by "files"."file_srl" desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_file_getFileList_Not_In_Empty_String_Value(){ - $xml_file = _XE_PATH_ . "modules/file/queries/getFileList.xml"; - $argsString = '$args->exclude_module_srl = ""; $args->s_module_srl = array(12); '; - $expected = 'select "files".* - from "xe_files" as "files" - left join "xe_member" as "member" on "files"."member_srl" = "member"."member_srl" - where "files"."module_srl" in (12) - order by "files"."file_srl" desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_document_getDeclaredList_In_Query(){ - $xml_file = _XE_PATH_ . "modules/document/queries/getDeclaredList.xml"; - $argsString = "\$args->list_count = 30; - \$args->page_count = 10; - \$args->sort_index = 'document_declared.declared_count'; - \$args->order_type = 'desc';"; - $expected = 'select * from "xe_documents" as "documents" - , "xe_document_declared" as "document_declared" - where "documents"."document_srl" - in ("document_declared"."document_srl") - order by "document_declared"."declared_count" desc - limit 0, 30'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_getExpiredSession_curdate(){ - $xml_file = _XE_PATH_ . "modules/session/queries/getExpiredSessions.xml"; - $argsString = ''; - $expected = 'select "session_key" - from "xe_session" as "session" - where "expired" <= \'' . date("YmdHis") . '\''; - $this->_test($xml_file, $argsString, $expected); - } - - function test_rlike_1(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/rlike1.xml"; - $argsString = '$args->title = "aaa";'; - $expected = 'select * from "xe_modules" as "modules" where "title" rlike \'aaa\''; - define('__CUBRID_VERSION__', '8.4.1'); - $this->_test($xml_file, $argsString, $expected); - } - - - function test_resource_getLatestItem(){ - $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/resource.getLatestItem.xml"; - $expected = 'SELECT "package"."module_srl" as "module_srl" - , "package"."status" as "status" - , "package"."category_srl" as "category_srl" - , "package"."member_srl" as "member_srl" - , "package"."package_srl" as "package_srl" - , "package"."path" as "path" - , "package"."license" as "license" - , "package"."title" as "title" - , "package"."homepage" as "homepage" - , "package"."description" as "package_description" - , "package"."voter" as "package_voter" - , "package"."voted" as "package_voted" - , "package"."downloaded" as "package_downloaded" - , "package"."regdate" as "package_regdate" - , "package"."last_update" as "package_last_update" - , "member"."nick_name" as "nick_name" - , "member"."user_id" as "user_id" - , "item"."item_srl" as "item_srl" - , "item"."document_srl" as "document_srl" - , "item"."file_srl" as "item_file_srl" - , "item"."screenshot_url" as "item_screenshot_url" - , "item"."version" as "item_version" - , "item"."voter" as "item_voter" - , "item"."voted" as "item_voted" - , "item"."downloaded" as "item_downloaded" - , "item"."regdate" as "item_regdate" - FROM "xe_resource_packages" as "package" - , "xe_member" as "member" - , "xe_resource_items" as "item" - WHERE "package"."package_srl" = ? - and "package"."member_srl" = "member"."member_srl" - and "item"."item_srl" = "package"."latest_item_srl"'; - $argsString = '$args->package_srl = 18325662;'; - $expectedArgs = array(18325662); - $this->_testPreparedQuery($xml_file, $argsString, $expected, 'getSelectSql', $expectedArgs); - } - - /** - * Issue 1431 - xml click count error - */ - function testClickCount() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/click_count.xml"; - $argsString = '$args->incr_expose_count = true;'; - $expected = 'select INCR("expose_count") from "xe_modules" as "modules"'; - $this->_test($xml_file, $argsString, $expected); - } - - } diff --git a/tests/classes/db/db/xml_query/cubrid/CubridSubqueryTest.php b/tests/classes/db/db/xml_query/cubrid/CubridSubqueryTest.php deleted file mode 100644 index 42d5c59b0..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridSubqueryTest.php +++ /dev/null @@ -1,192 +0,0 @@ - */ - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - - class CubridSubqueryTest extends CubridTest { - var $xmlPath = 'data/'; - - function CubridSubqueryTest(){ - $this->xmlPath = str_replace('CubridSubqueryTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql'); - } - - function testSelectUncorrelated1(){ - $xml_file = $this->xmlPath . "select_uncorrelated1.xml"; - $argsString = '$args->user_id = 4; - '; - $expected = 'select "column_a" as "value_a" - , (select max("column_b") as "count" - from "xe_table_b" as "table_b" - ) as "value_b" - from "xe_table_a" as "table_a" - where "column_a" = 4'; - $this->_test($xml_file, $argsString, $expected); - } - - function testSelectUncorrelated2(){ - $xml_file = $this->xmlPath . "select_uncorrelated2.xml"; - $argsString = '$args->user_id = 4; - $args->user_name = 7; - '; - $expected = 'SELECT "column_a" as "value_a" - , "column_b" as "value_b" - , "column_c" as "value_c" - , (SELECT max("column_b") as "count" - FROM "xe_table_b" as "table_b" - WHERE "column_ab" = 7) as "value_b" - FROM "xe_table_a" as "table_a" - WHERE "column_a" = 4'; - $this->_test($xml_file, $argsString, $expected); - } - - function testFromUncorrelated1(){ - $xml_file = $this->xmlPath . "from_uncorrelated1.xml"; - $argsString = '$args->user_id = 4; - $args->user_name = 7; - '; - $expected = 'select max("documentcountbymember"."count") as "maxcount" - from ( - select "member_srl" as "member_srl" - , count(*) as "count" - from "xe_documents" as "documents" - group by "member_srl" - ) as "documentcountbymember"'; - $this->_test($xml_file, $argsString, $expected); - } - -// function testFromUncorrelated2(){ -// $xml_file = $this->xmlPath . "from_uncorrelated1.xml"; -// $argsString = '$args->user_id = 4; -// $args->user_name = 7; -// '; -// $expected = 'select max("documentcountbymember"."count") as "maxcount" -// from ( -// select "member_srl" as "member_srl" -// , count(*) as "count" -// from "xe_documents" as "documents" -// group by "member_srl" -// ) as "documentcountbymember"'; -// $this->_test($xml_file, $argsString, $expected); -// } - - function testFromUncorrelated2(){ - $xml_file = $this->xmlPath . "from_uncorrelated2.xml"; - $argsString = '$args->member_srl = 4; - $args->module_srl = 7; - '; - $expected = 'select max("documentcountbymember"."count") as "maxcount" - from ( - select "member_srl" as "member_srl" - , count(*) as "count" - from "xe_documents" as "documents" - where "module_srl" = 7 - group by "member_srl" - ) as "documentcountbymember" - where "member_srl" = 4 - '; - $this->_test($xml_file, $argsString, $expected); - } - - function testSelectCorrelated1(){ - $xml_file = $this->xmlPath . "select_correlated1.xml"; - $argsString = '$args->user_id = 7;'; - $expected = 'select *, - (select count(*) as "count" - from "xe_documents" as "documents" - where "documents"."user_id" = "member"."user_id" - ) as "totaldocumentcount" - from "xe_member" as "member" - where "user_id" = \'7\''; - $this->_test($xml_file, $argsString, $expected); - } - - function testSelectCorrelated2(){ - $xml_file = $this->xmlPath . "select_correlated2.xml"; - $argsString = '$args->user_id = 7; - $args->module_srl = 17; - '; - $expected = 'select *, - (select count(*) as "count" - from "xe_documents" as "documents" - where "documents"."user_id" = "member"."user_id" - and "module_srl" = 17 - ) as "totaldocumentcount" - from "xe_member" as "member" - where "user_id" = \'7\''; - $this->_test($xml_file, $argsString, $expected); - } - - function testWhereCorrelated1(){ - $xml_file = $this->xmlPath . "where_correlated1.xml"; - $argsString = ''; - $expected = 'select * - from "xe_member" as "member" - where "regdate" = ( - select max("regdate") as "maxregdate" - from "xe_documents" as "documents" - where "documents"."user_id" = "member"."user_id" - )'; - $this->_test($xml_file, $argsString, $expected); - } - - function testWhereCorrelated2(){ - $xml_file = $this->xmlPath . "where_correlated2.xml"; - $argsString = '$args->module_srl = 12; $args->member_srl = 19;'; - $expected = 'select * - from "xe_member" as "member" - where "member_srl" = 19 - and "regdate" = ( - select max("regdate") as "maxregdate" - from "xe_documents" as "documents" - where "documents"."user_id" = "member"."user_id" - and "module_srl" = 12 - ) - '; - $this->_test($xml_file, $argsString, $expected); - } - - function testFromCorrelated1(){ - $xml_file = $this->xmlPath . "from_correlated1.xml"; - $argsString = ''; - $expected = 'select "m"."member_srl" - , "m"."nickname" - , "m"."regdate" - , "a"."count" - from ( - select "member_srl" as "member_srl" - , count(*) as "count" - from "xe_documents" as "documents" - group by "member_srl" - ) as "a" - left join "xe_member" as "m" on "m"."member" = "a"."member_srl"'; - $this->_test($xml_file, $argsString, $expected); - } - - function testFromCorrelated2(){ - $xml_file = $this->xmlPath . "from_correlated2.xml"; - $argsString = '$args->module_srl = 12; $args->count = 20;'; - $expected = 'select "m"."member_srl" - , "m"."nickname" - , "m"."regdate" - , "a"."count" - from ( - select "member_srl" as "member_srl" - , count(*) as "count" - from "xe_documents" as "documents" - where "module_srl" = 12 - group by "member_srl" - ) as "a" - left join "xe_member" as "m" on "m"."member" = "a"."member_srl" - where "a"."count" >= 20 -'; - $this->_test($xml_file, $argsString, $expected); - } - } -?> diff --git a/tests/classes/db/db/xml_query/cubrid/CubridUpdateTest.php b/tests/classes/db/db/xml_query/cubrid/CubridUpdateTest.php deleted file mode 100644 index 2f1012d4b..000000000 --- a/tests/classes/db/db/xml_query/cubrid/CubridUpdateTest.php +++ /dev/null @@ -1,98 +0,0 @@ - */ - - class CubridUpdateTest extends CubridTest { - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql'); - } - - function test_module_updateModule(){ - $xml_file = _XE_PATH_ . "modules/module/queries/updateModule.xml"; - $argsString = ' $args->module_category_srl = 0; - $args->browser_title = "test"; - $args->layout_srl = 0; - $args->mlayout_srl = 0; - $args->module = "page"; - $args->mid = "test"; - $args->use_mobile = ""; - $args->site_srl = 0; - $args->module_srl = 47374;'; - $expected = 'update "xe_modules" as "modules" - set "module" = \'page\' - , "module_category_srl" = 0 - , "layout_srl" = 0 - , "mid" = \'test\' - , "browser_title" = \'test\' - , "description" = \'\' - , "is_default" = \'n\' - , "open_rss" = \'y\' - , "header_text" = \'\' - , "footer_text" = \'\' - , "mlayout_srl" = 0 - , "use_mobile" = \'n\' - where "site_srl" = 0 and "module_srl" = 47374'; -// $expected = 'UPDATE "xe_modules" as "modules" -// SET "module" = \'page\' -// , "mid" = \'test\' -// , "browser_title" = \'test\' -// , "description" = \'\' -// , "is_default" = \'N\' -// , "open_rss" = \'Y\' -// , "header_text" = \'\' -// , "footer_text" = \'\' -// , "use_mobile" = \'n\' -// WHERE "site_srl" = 0 -// AND "module_srl" = 47374'; - $this->_test($xml_file, $argsString, $expected); - } - function test_member_updateLastLogin(){ - $xml_file = _XE_PATH_ . "modules/member/queries/updateLastLogin.xml"; - $argsString = ' $args->member_srl = 4; - $args->last_login = "20110607120549";'; - $expected = 'UPDATE "xe_member" as "member" SET "member_srl" = 4, "last_login" = \'20110607120549\' WHERE "member_srl" = 4'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_updatePoint(){ - $xml_file = _XE_PATH_ . "modules/point/queries/updatePoint.xml"; - $argsString = ' $args->member_srl = 4; - $args->point = 105;'; - $expected = 'UPDATE "xe_point" as "point" SET "point" = 105 WHERE "member_srl" = 4'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_updateCounterUnique(){ - $xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml"; - $argsString = '$args->regdate = 20110607; - '; - $expected = 'UPDATE "xe_counter_status" as "counter_status" SET "unique_visitor" = "unique_visitor" + 1, - "pageview" = "pageview" + 1 WHERE "regdate" = 20110607 '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_updateMenu(){ - $xml_file = _XE_PATH_ . "modules/menu/queries/updateMenu.xml"; - $argsString = '$args->menu_srl = 204; - $args->title = "test_menu"; - '; - $expected = 'UPDATE "xe_menu" as "menu" SET "title" = \'test_menu\' WHERE "menu_srl" = 204'; - $this->_test($xml_file, $argsString, $expected); - } - - - function test_menu_updateMenuItemNode(){ - $xml_file = _XE_PATH_ . "modules/menu/queries/updateMenuItemNode.xml"; - $argsString = '$args->parent_srl = 0; - $args->menu_srl = 237423; - $args->listorder = -8; - $args->menu_item_srl = 237431;'; - $expected = 'UPDATE "xe_menu_item" as "menu_item" SET "parent_srl" = 0, "listorder" = -8 WHERE "menu_item_srl" = 237431'; - $this->_test($xml_file, $argsString, $expected); - } - -// $queryTester->test_admin_deleteActionForward(); -// $queryTester->test_module_insertModule(); - - - } diff --git a/tests/classes/db/db/xml_query/cubrid/data/click_count.xml b/tests/classes/db/db/xml_query/cubrid/data/click_count.xml deleted file mode 100644 index 3dd210b09..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/click_count.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/doc_subquery.xml b/tests/classes/db/db/xml_query/cubrid/data/doc_subquery.xml deleted file mode 100644 index 5709c7a17..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/doc_subquery.xml +++ /dev/null @@ -1,21 +0,0 @@ - - -
    - - - - - - - -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/from_correlated1.xml b/tests/classes/db/db/xml_query/cubrid/data/from_correlated1.xml deleted file mode 100644 index 7c2c27143..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/from_correlated1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - -
    - -
    - - - - - - - - -
    - - - - -
    -
    - - - - - - -
    \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/from_correlated2.xml b/tests/classes/db/db/xml_query/cubrid/data/from_correlated2.xml deleted file mode 100644 index 8dc162154..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/from_correlated2.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
    - - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - -
    \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated1.xml b/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated1.xml deleted file mode 100644 index ec83f3f36..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated1.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - -
    - - - - - - - - -
    -
    - - - -
    \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated2.xml b/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated2.xml deleted file mode 100644 index 6431b3b90..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/from_uncorrelated2.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - -
    - - - - - - - - - - - -
    -
    - - - - - - -
    \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/ignore_index_hint.xml b/tests/classes/db/db/xml_query/cubrid/data/ignore_index_hint.xml deleted file mode 100644 index e911abce5..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/ignore_index_hint.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/index_hint_for_all.xml b/tests/classes/db/db/xml_query/cubrid/data/index_hint_for_all.xml deleted file mode 100644 index b0784fa94..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/index_hint_for_all.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/mysql_index_hint.xml b/tests/classes/db/db/xml_query/cubrid/data/mysql_index_hint.xml deleted file mode 100644 index 702080eb5..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/mysql_index_hint.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/one_index_hint_one_table.xml b/tests/classes/db/db/xml_query/cubrid/data/one_index_hint_one_table.xml deleted file mode 100644 index 070ed3697..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/one_index_hint_one_table.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/opage.getOpageList.xml b/tests/classes/db/db/xml_query/cubrid/data/opage.getOpageList.xml deleted file mode 100644 index 2e7964335..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/opage.getOpageList.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/cubrid/data/resource.getLatestItem.xml b/tests/classes/db/db/xml_query/cubrid/data/resource.getLatestItem.xml deleted file mode 100644 index f6fa06e83..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/resource.getLatestItem.xml +++ /dev/null @@ -1,40 +0,0 @@ - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/cubrid/data/rlike1.xml b/tests/classes/db/db/xml_query/cubrid/data/rlike1.xml deleted file mode 100644 index 895b1ccb0..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/rlike1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - diff --git a/tests/classes/db/db/xml_query/cubrid/data/select_correlated1.xml b/tests/classes/db/db/xml_query/cubrid/data/select_correlated1.xml deleted file mode 100644 index 797d878e3..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/select_correlated1.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -
    - - - - - -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/select_correlated2.xml b/tests/classes/db/db/xml_query/cubrid/data/select_correlated2.xml deleted file mode 100644 index 85ab25308..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/select_correlated2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - -
    - - - - - -
    - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated1.xml b/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated1.xml deleted file mode 100644 index 00e556e35..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated1.xml +++ /dev/null @@ -1,19 +0,0 @@ - - -
    - - - - - -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated2.xml b/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated2.xml deleted file mode 100644 index a42294bcf..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/select_uncorrelated2.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - -
    - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/syndication.getGrantedModules.xml b/tests/classes/db/db/xml_query/cubrid/data/syndication.getGrantedModules.xml deleted file mode 100644 index 97d2b4ec9..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/syndication.getGrantedModules.xml +++ /dev/null @@ -1,19 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/cubrid/data/syndication.getModules.xml b/tests/classes/db/db/xml_query/cubrid/data/syndication.getModules.xml deleted file mode 100644 index fbbe83ad9..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/syndication.getModules.xml +++ /dev/null @@ -1,26 +0,0 @@ - - -
    -
    -
    - - - -
    -
    - - - - - - - - - - - - - - - -
    diff --git a/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables.xml b/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables.xml deleted file mode 100644 index 6656d3b98..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables_combined.xml b/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables_combined.xml deleted file mode 100644 index f2ac06e76..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/three_index_hints_two_tables_combined.xml +++ /dev/null @@ -1,14 +0,0 @@ - - -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/two_index_hints_one_table.xml b/tests/classes/db/db/xml_query/cubrid/data/two_index_hints_one_table.xml deleted file mode 100644 index 832becd1b..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/two_index_hints_one_table.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/where_correlated1.xml b/tests/classes/db/db/xml_query/cubrid/data/where_correlated1.xml deleted file mode 100644 index f6115c71f..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/where_correlated1.xml +++ /dev/null @@ -1,21 +0,0 @@ - - -
    - - - - - - - -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/where_correlated2.xml b/tests/classes/db/db/xml_query/cubrid/data/where_correlated2.xml deleted file mode 100644 index 2ab45461c..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/where_correlated2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - -
    - - - - - - - - -
    - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/cubrid/data/where_uncorrelated1.xml b/tests/classes/db/db/xml_query/cubrid/data/where_uncorrelated1.xml deleted file mode 100644 index 248b63ae9..000000000 --- a/tests/classes/db/db/xml_query/cubrid/data/where_uncorrelated1.xml +++ /dev/null @@ -1,18 +0,0 @@ - - -
    - - - - - - - -
    - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/MssqlIndexHintTest.php b/tests/classes/db/db/xml_query/mssql/MssqlIndexHintTest.php deleted file mode 100644 index 307381d20..000000000 --- a/tests/classes/db/db/xml_query/mssql/MssqlIndexHintTest.php +++ /dev/null @@ -1,65 +0,0 @@ - */ - - class MssqlIndexHintTest extends MssqlTest { - var $xmlPath = 'data/'; - - function MssqlIndexHintTest(){ - $this->xmlPath = str_replace('MssqlIndexHintTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql'); - } - - function testOneUseIndexHintAndOneTable(){ - $xml_file = $this->xmlPath . "one_index_hint_one_table.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member] with(index([idx_member_list_order]))'; - $this->_test($xml_file, $argsString, $expected); - } - - - function testTwoUseIndexHintsAndOneTable(){ - $xml_file = $this->xmlPath . "two_index_hints_one_table.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member] with(index([idx_member_list_order]), index([idx_member_srl]))'; - $this->_test($xml_file, $argsString, $expected); - } - - function testThreeUseIndexHintsAndTwoTables(){ - $xml_file = $this->xmlPath . "three_index_hints_two_tables.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member] with(index([idx_member_list_order]), index([idx_member_srl])) - , [xe_document] as [document] with(index([idx_document_srl]))'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Tests that index is added if "for" attribute is "ALL" - * - * example: ... - */ - function testIndexHintForAll(){ - $xml_file = $this->xmlPath . "index_hint_for_all.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member] with(index([idx_member_list_order]))'; - $this->_test($xml_file, $argsString, $expected); - } - - - function testIgnoreIndexHintIsSkipped(){ - $xml_file = $this->xmlPath . "ignore_index_hint.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member]'; - $this->_test($xml_file, $argsString, $expected); - } - - function testMysqlIndexHintIsSkipped(){ - $xml_file = $this->xmlPath . "mysql_index_hint.xml"; - $argsString = ''; - $expected = 'select * from [xe_member] as [member]'; - $this->_test($xml_file, $argsString, $expected); - } - } -?> diff --git a/tests/classes/db/db/xml_query/mssql/MssqlSelectOnlineTest.php b/tests/classes/db/db/xml_query/mssql/MssqlSelectOnlineTest.php deleted file mode 100644 index aef9cc250..000000000 --- a/tests/classes/db/db/xml_query/mssql/MssqlSelectOnlineTest.php +++ /dev/null @@ -1,12 +0,0 @@ - */ - class MssqlSelectOnlineTest extends MssqlOnlineTest { - - function test_syndication_getGrantedModule(){ - $args->module_srl = 67; - $output = executeQuery("syndication.getGrantedModule", $args); - $this->assertEquals(0, $output->error, $output->error + ' ' + $output->message); - } - } - -?> diff --git a/tests/classes/db/db/xml_query/mssql/MssqlSelectTest.php b/tests/classes/db/db/xml_query/mssql/MssqlSelectTest.php deleted file mode 100644 index 64b3d3524..000000000 --- a/tests/classes/db/db/xml_query/mssql/MssqlSelectTest.php +++ /dev/null @@ -1,171 +0,0 @@ - */ - - class MssqlSelectTest extends MssqlTest { - - function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){ - $this->_testPreparedQuery($xml_file, $argsString, $expected, 'getSelectSql', $expectedArgs); - } - - function testSelectStar(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml"; - $argsString = '$args->module_srl = 10;'; - $expected = 'SELECT * FROM [xe_module_admins] as [module_admins] , [xe_member] as [member] WHERE [module_srl] = ? and [member].[member_srl] = [module_admins].[member_srl]'; - $this->_test($xml_file, $argsString, $expected, array(10)); - } - - function testRequiredParameter(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml"; - $argsString = ''; - $expected = 'Date incorecte! Query-ul nu a putut fi executat.'; - $this->_test($xml_file, $argsString, $expected); - } - - function testWithoutCategoriesTag(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleCategories.xml"; - $argsString = ''; - $expected = 'SELECT * FROM [xe_module_categories] as [module_categories] ORDER BY [title] asc'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_module_getDefaultModules(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getDefaultModules.xml"; - $argsString = '$args->site_srl = 0;'; - $expected = 'SELECT [modules].[site_srl] - , [modules].[module] - , [modules].[mid] - , [modules].[browser_title] - , [module_categories].[title] as [category] - , [modules].[module_srl] - FROM [xe_modules] as [modules] - left join [xe_module_categories] as [module_categories] - on [module_categories].[module_category_srl] = [modules].[module_category_srl] - WHERE [modules].[site_srl] = ? - ORDER BY [modules].[module] asc, [module_categories].[title] asc, [modules].[mid] asc'; - $this->_test($xml_file, $argsString, $expected, array(0)); - } - - function test_module_getSiteInfo(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getSiteInfo.xml"; - $argsString = '$args->site_srl = 0;'; - $expected = 'SELECT [modules].[site_srl] as [module_site_srl] - , [modules].[module_srl] as [module_srl] - , [modules].[module] as [module] - , [modules].[module_category_srl] as [module_category_srl] - , [modules].[layout_srl] as [layout_srl] - , [modules].[mlayout_srl] as [mlayout_srl] - , [modules].[use_mobile] as [use_mobile] - , [modules].[menu_srl] as [menu_srl] - , [modules].[mid] as [mid] - , [modules].[skin] as [skin] - , [modules].[mskin] as [mskin] - , [modules].[browser_title] as [browser_title] - , [modules].[description] as [description] - , [modules].[is_default] as [is_default] - , [modules].[content] as [content] - , [modules].[mcontent] as [mcontent] - , [modules].[open_rss] as [open_rss] - , [modules].[header_text] as [header_text] - , [modules].[footer_text] as [footer_text] - , [modules].[regdate] as [regdate] - , [sites].[site_srl] as [site_srl] - , [sites].[domain] as [domain] - , [sites].[index_module_srl] as [index_module_srl] - , [sites].[default_language] as [default_language] - FROM [xe_sites] as [sites] - left join [xe_modules] as [modules] on [modules].[module_srl] = [sites].[index_module_srl] - WHERE [sites].[site_srl] = ? '; - $this->_test($xml_file, $argsString, $expected, array(0)); - } - - function test_addon_getAddonInfo(){ - $xml_file = _XE_PATH_ . "modules/addon/queries/getAddonInfo.xml"; - $argsString = '$args->addon = "captcha";'; - $expected = 'SELECT * - FROM [xe_addons] as [addons] - WHERE [addon] = ? '; - $this->_test($xml_file, $argsString, $expected, array("'captcha'")); - } - - function test_addon_getAddons(){ - $xml_file = _XE_PATH_ . "modules/addon/queries/getAddons.xml"; - $argsString = ''; - $expected = 'SELECT * - FROM [xe_addons] as [addons] - ORDER BY [addon] asc'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_admin_getCommentCount(){ - $xml_file = _XE_PATH_ . "modules/admin/queries/getCommentCount.xml"; - $argsString = ''; - $expected = 'SELECT count(*) as [count] - FROM [xe_comments] as [comments]'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_admin_getCommentDeclaredStatus(){ - $xml_file = _XE_PATH_ . "modules/admin/queries/getCommentDeclaredStatus.xml"; - $argsString = '$args->date = "20110411";'; - $expected = 'SELECT TOP 2 substr([regdate],1,8) as [date], count(*) as [count] - FROM [xe_comment_declared_log] as [comment_declared_log] - WHERE [regdate] >= ? - GROUP BY substr([regdate],1,8) - ORDER BY substr([regdate],1,8) asc'; - $this->_test($xml_file, $argsString, $expected, array("'20110411'")); - } - - function test_member_getAutoLogin(){ - $xml_file = _XE_PATH_ . "modules/member/queries/getAutoLogin.xml"; - $argsString = '$args->autologin_key = 10;'; - $expected = 'SELECT [member].[user_id] as [user_id] - , [member].[password] as [password] - , [member_autologin].[autologin_key] as [autologin_key] - FROM [xe_member] as [member] , [xe_member_autologin] as [member_autologin] - WHERE [member_autologin].[autologin_key] = ? - and [member].[member_srl] = [member_autologin].[member_srl]'; - $this->_test($xml_file, $argsString, $expected, array("'10'")); - } - - /** - * Query fails because XML is wrong - title column does not exist - * in xe_modules. Maybe the developer ment "browser_title" - */ - function test_opage_getOpageList(){ - $xml_file = _TEST_PATH_ . "db/xml_query/mssql/data/opage.getOpageList.xml"; - $argsString = '$args->s_title = "yuhuu"; - $args->module = \'opage\';'; - $expected = 'SELECT TOP 20 * - FROM [xe_modules] as [modules] - WHERE [module] = \'opage\' and ([title] like ?) - ORDER BY [module_srl] desc'; - $this->_test($xml_file, $argsString, $expected, array("'%yuhuu%'")); - } - - function test_module_getExtraVars(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleExtraVars.xml"; - $argsString = '$args->module_srl = 25;'; - $expected = 'SELECT * FROM [xe_module_extra_vars] as [module_extra_vars] WHERE [module_srl] in (?)'; - $this->_test($xml_file, $argsString, $expected, array(array(25))); - } - - function test_module_getModuleSites(){ - $xml_file = _XE_PATH_ . "modules/module/queries/getModuleSites.xml"; - $argsString = '$args->module_srls = "67, 65";'; - $expected = 'SELECT [modules].[module_srl] as [module_srl], [sites].[domain] as [domain] FROM [xe_modules] as [modules] , [xe_sites] as [sites] WHERE [modules].[module_srl] in (?,?) and [sites].[site_srl] = [modules].[site_srl]'; - $this->_test($xml_file, $argsString, $expected, array(array(67, 65))); - } - - function test_syndication_getGrantedModule(){ - $xml_file = _TEST_PATH_ . "db/xml_query/mssql/data/syndication.getGrantedModule.xml"; - $argsString = '$args->module_srl = 67;'; - $expected = 'select count(*) as [count] - from [xe_module_grants] as [module_grants] - where [module_srl] = ? - and [name] in (\'access\',\'view\',\'list\') - and ([group_srl] >= 1 - or [group_srl] = -1 - or [group_srl] = -2)'; - $this->_test($xml_file, $argsString, $expected, array(67)); - } - } diff --git a/tests/classes/db/db/xml_query/mssql/MssqlUpdateOnlineTest.php b/tests/classes/db/db/xml_query/mssql/MssqlUpdateOnlineTest.php deleted file mode 100644 index 704771aa3..000000000 --- a/tests/classes/db/db/xml_query/mssql/MssqlUpdateOnlineTest.php +++ /dev/null @@ -1,13 +0,0 @@ - */ - class MssqlUpdateOnlineTest extends MssqlOnlineTest { - - function test_counter_updateCounterUnique(){ - $args->regdate = 20110211; - - $output = executeQuery("counter.updateCounterUnique", $args); - $this->assertEquals(0, $output->error, $output->error + ' ' + $output->message); - } - } - -?> diff --git a/tests/classes/db/db/xml_query/mssql/MssqlUpdateTest.php b/tests/classes/db/db/xml_query/mssql/MssqlUpdateTest.php deleted file mode 100644 index 8d45a548c..000000000 --- a/tests/classes/db/db/xml_query/mssql/MssqlUpdateTest.php +++ /dev/null @@ -1,23 +0,0 @@ - */ - -class MssqlUpdateTest extends MssqlTest { - - function _test($xml_file, $argsString, $expected, $expectedArgs = NULL) { - $this->_testPreparedQuery($xml_file, $argsString, $expected, 'getUpdateSql', $expectedArgs = NULL); - } - - function test_counter_updateCounterUnique() { - $xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml"; - $argsString = '$args->regdate = 25;'; - $expected = 'UPDATE [counter_status] - SET [unique_visitor] = [unique_visitor] + ? - , [pageview] = [pageview] + ? - FROM [xe_counter_status] as [counter_status] - WHERE [regdate] = ?'; - $this->_test($xml_file, $argsString, $expected, array("25", 1, 1)); - } - -} - -?> diff --git a/tests/classes/db/db/xml_query/mssql/data/ignore_index_hint.xml b/tests/classes/db/db/xml_query/mssql/data/ignore_index_hint.xml deleted file mode 100644 index e17cfde49..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/ignore_index_hint.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/data/index_hint_for_all.xml b/tests/classes/db/db/xml_query/mssql/data/index_hint_for_all.xml deleted file mode 100644 index b0784fa94..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/index_hint_for_all.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/data/mysql_index_hint.xml b/tests/classes/db/db/xml_query/mssql/data/mysql_index_hint.xml deleted file mode 100644 index 702080eb5..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/mysql_index_hint.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/data/one_index_hint_one_table.xml b/tests/classes/db/db/xml_query/mssql/data/one_index_hint_one_table.xml deleted file mode 100644 index 54b660823..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/one_index_hint_one_table.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/data/opage.getOpageList.xml b/tests/classes/db/db/xml_query/mssql/data/opage.getOpageList.xml deleted file mode 100644 index 2e7964335..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/opage.getOpageList.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mssql/data/syndication.getGrantedModule.xml b/tests/classes/db/db/xml_query/mssql/data/syndication.getGrantedModule.xml deleted file mode 100644 index 9a2f20e29..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/syndication.getGrantedModule.xml +++ /dev/null @@ -1,17 +0,0 @@ - - -
    - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mssql/data/three_index_hints_two_tables.xml b/tests/classes/db/db/xml_query/mssql/data/three_index_hints_two_tables.xml deleted file mode 100644 index f3a05c237..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/three_index_hints_two_tables.xml +++ /dev/null @@ -1,14 +0,0 @@ - - -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mssql/data/two_index_hints_one_table.xml b/tests/classes/db/db/xml_query/mssql/data/two_index_hints_one_table.xml deleted file mode 100644 index def6aadab..000000000 --- a/tests/classes/db/db/xml_query/mssql/data/two_index_hints_one_table.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/MysqlIndexHintTest.php b/tests/classes/db/db/xml_query/mysql/MysqlIndexHintTest.php deleted file mode 100644 index bec4ac6c7..000000000 --- a/tests/classes/db/db/xml_query/mysql/MysqlIndexHintTest.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - - class MysqlIndexHintTest extends MysqlTest { - var $xmlPath = 'data/'; - - function MysqlIndexHintTest(){ - $this->xmlPath = str_replace('MysqlIndexHintTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; - } - - function _test($xml_file, $argsString, $expected){ - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql'); - } - - function testOneUseIndexHintAndOneTable(){ - $xml_file = $this->xmlPath . "one_index_hint_one_table.xml"; - $argsString = ''; - $expected = 'select * from `xe_member` as `member` use index (`idx_member_list_order`)'; - $this->_test($xml_file, $argsString, $expected); - } - - - function testTwoUseIndexHintsAndOneTable(){ - $xml_file = $this->xmlPath . "two_index_hints_one_table.xml"; - $argsString = ''; - $expected = 'select * from `xe_member` as `member` use index (`idx_member_list_order`, `idx_member_srl`)'; - $this->_test($xml_file, $argsString, $expected); - } - - function testThreeUseIndexHintsAndTwoTables(){ - $xml_file = $this->xmlPath . "three_index_hints_two_tables.xml"; - $argsString = ''; - $expected = 'select * from `xe_member` as `member` use index (`idx_member_list_order`, `idx_member_srl`) - , `xe_document` as `document` use index (`idx_document_srl`)'; - $this->_test($xml_file, $argsString, $expected); - } - - function testThreeIndexHintsAndTwoTables_ForceAndIgnore(){ - $xml_file = $this->xmlPath . "three_index_hints_two_tables_combined.xml"; - $argsString = ''; - $expected = 'select * from `xe_member` as `member` force index (`idx_member_list_order`, `idx_member_srl`) - , `xe_document` as `document` ignore index (`idx_document_srl`)'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Tests that index is added if "for" attribute is "ALL" - * - * example: ... - */ - function testIndexHintForAll(){ - $xml_file = $this->xmlPath . "index_hint_for_all.xml"; - $argsString = ''; - $expected = 'select * from `xe_member` as `member` use index (`idx_member_list_order`)'; - $this->_test($xml_file, $argsString, $expected); - } - - } -?> diff --git a/tests/classes/db/db/xml_query/mysql/MysqlInsertTest.php b/tests/classes/db/db/xml_query/mysql/MysqlInsertTest.php deleted file mode 100644 index aeb6c7057..000000000 --- a/tests/classes/db/db/xml_query/mysql/MysqlInsertTest.php +++ /dev/null @@ -1,76 +0,0 @@ - */ - -/** - * @class MysqlInsertTest - * @brief Constains all test method for insert statements, using Mysql SQL syntax - * @developer Corina Udrescu (xe_dev@arnia.ro) - */ -class MysqlInsertTest extends MysqlTest -{ - /** - * @brief _test - local helper method - * @developer Corina Udrescu (xe_dev@arnia.ro) - * @access private - * @param $xml_file string - Path to XML file containing the query to be tested - * @param $argsString string - String containing PHP code that initializez the arguments that the query receives - * @param $expected string - Expected SQL query as string - * @param $columnList array - Array containing the column names that will be retrieved, in case only a part of the ones in the query file are needed - * @return void - */ - function _test($xml_file, $argsString, $expected, $columnList = NULL) - { - $this->_testQuery($xml_file, $argsString, $expected, 'getInsertSql', $columnList); - } - - function testInsertIntoNumericColumnConvertsValue() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/member_insert_injection.xml"; - $argsString = '$args->member_srl = 7; - $args->find_account_question = "1\'"; - '; - $expected = 'insert into `xe_member` (`member_srl`, `find_account_question`) values (7, 1)'; - $this->_test($xml_file, $argsString, $expected); - } - - -} - -/* End of file MysqlInsertTest.php */ -/* Location: ./tests/classes/db/db/xml_query/mysql/MysqlInsertTest.php */ - /** - * @brief testInsertSelectStatement - checks that when query action is 'insert-selct' an 'INSERT INTO .. SELECT ...' statement is properly generated - * @developer Corina Udrescu (xe_dev@arnia.ro) - * @access public - * @return void - */ - function testInsertSelectStatement() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/insert_select.xml"; - $argsString = '$args->condition_value = 7;'; - $expected = 'insert into `xe_table1` (`column1`, `column2`, `column3`) - select `column4`, `column5`, `column6` - from `xe_table2` as `table2` - where `column4` >= 7'; - $this->_test($xml_file, $argsString, $expected); - } - - function testInsertSelectStatement2() - { - $xml_file = _XE_PATH_ . "modules/wiki/queries/insertLinkedDocuments.xml"; - $argsString = '$args->document_srl = 7; - $args->module_srl = 10; - $args->alias_list = array("unu", "doi"); - '; - $expected = 'insert into `xe_wiki_links` - (`cur_doc_srl`, `link_doc_srl`) - select 7, `document_srl` - from `xe_document_aliases` as `document_aliases` - where `module_srl` = 10 - and `alias_title` in (\'unu\',\'doi\')'; - $this->_test($xml_file, $argsString, $expected); - } -} - -/* End of file MysqlInsertTest.php */ -/* Location: ./tests/classes/db/db/xml_query/mysql/MysqlInsertTest.php */ diff --git a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php b/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php deleted file mode 100644 index 53d2a6583..000000000 --- a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php +++ /dev/null @@ -1,417 +0,0 @@ - */ - -class MysqlSelectTest extends MysqlTest { - - function _test($xml_file, $argsString, $expected, $columnList = NULL) { - $this->_testQuery($xml_file, $argsString, $expected, 'getSelectSql', $columnList); - } - - function testConditionWithVarAndColumnDefaultValue_WithoutArgument() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItem.xml"; - $argsString = '$args->item_srl = "";'; - $expected = 'select `package`.`module_srl` as `module_srl` - , `package`.`status` as `status` - , `package`.`category_srl` as `category_srl` - , `package`.`member_srl` as `member_srl` - , `package`.`package_srl` as `package_srl` - , `package`.`path` as `path` - , `package`.`license` as `license` - , `package`.`title` as `title` - , `package`.`homepage` as `homepage` - , `package`.`description` as `package_description` - , `package`.`voter` as `package_voter` - , `package`.`voted` as `package_voted` - , `package`.`downloaded` as `package_downloaded` - , `package`.`regdate` as `package_regdate` - , `package`.`last_update` as `package_last_update` - , `member`.`nick_name` as `nick_name` - , `member`.`user_id` as `user_id` - , `item`.`item_srl` as `item_srl` - , `item`.`document_srl` as `document_srl` - , `item`.`file_srl` as `item_file_srl` - , `item`.`screenshot_url` as `item_screenshot_url` - , `item`.`version` as `item_version` - , `item`.`voter` as `item_voter` - , `item`.`voted` as `item_voted` - , `item`.`downloaded` as `item_downloaded` - , `item`.`regdate` as `item_regdate` - from `xe_resource_packages` as `package` - , `xe_member` as `member` - , `xe_resource_items` as `item` - where `package`.`member_srl` = `member`.`member_srl` - and `item`.`item_srl` = `package`.`latest_item_srl`'; - $this->_test($xml_file, $argsString, $expected); - } - - function testConditionWithVarAndColumnDefaultValue_WithArgument() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItem.xml"; - $argsString = '$args->item_srl = "10";'; - $expected = 'select `package`.`module_srl` as `module_srl` - , `package`.`status` as `status` - , `package`.`category_srl` as `category_srl` - , `package`.`member_srl` as `member_srl` - , `package`.`package_srl` as `package_srl` - , `package`.`path` as `path` - , `package`.`license` as `license` - , `package`.`title` as `title` - , `package`.`homepage` as `homepage` - , `package`.`description` as `package_description` - , `package`.`voter` as `package_voter` - , `package`.`voted` as `package_voted` - , `package`.`downloaded` as `package_downloaded` - , `package`.`regdate` as `package_regdate` - , `package`.`last_update` as `package_last_update` - , `member`.`nick_name` as `nick_name` - , `member`.`user_id` as `user_id` - , `item`.`item_srl` as `item_srl` - , `item`.`document_srl` as `document_srl` - , `item`.`file_srl` as `item_file_srl` - , `item`.`screenshot_url` as `item_screenshot_url` - , `item`.`version` as `item_version` - , `item`.`voter` as `item_voter` - , `item`.`voted` as `item_voted` - , `item`.`downloaded` as `item_downloaded` - , `item`.`regdate` as `item_regdate` - from `xe_resource_packages` as `package` - , `xe_member` as `member` - , `xe_resource_items` as `item` - where `package`.`member_srl` = `member`.`member_srl` - and `item`.`item_srl` = 10'; - $this->_test($xml_file, $argsString, $expected); - } - - function testSubstring() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/substring.xml"; - $argsString = '$args->var_start_mmdd = "1102"; '; - $expected = 'select * from `xe_member` as `member` where substr(`extra_vars_t1`.`value`,5,4) >= 1102'; - $this->_test($xml_file, $argsString, $expected); - } - - function testResource_getLatestItemList() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItemList.xml"; - $argsString = ''; - $expected = 'select `package`.`module_srl` as `module_srl` - , `package`.`status` as `status` - , `package`.`category_srl` as `category_srl` - , `package`.`member_srl` as `member_srl` - , `package`.`package_srl` as `package_srl` - , `package`.`path` as `path` - , `package`.`license` as `license` - , `package`.`title` as `title` - , `package`.`homepage` as `homepage` - , `package`.`description` as `package_description` - , `package`.`voter` as `package_voter` - , `package`.`voted` as `package_voted` - , `package`.`downloaded` as `package_downloaded` - , `package`.`regdate` as `package_regdate` - , `package`.`last_update` as `package_last_update` - , `member`.`nick_name` as `nick_name` - , `member`.`user_id` as `user_id` - , `item`.`item_srl` as `item_srl` - , `item`.`document_srl` as `item_document_srl` - , `item`.`file_srl` as `item_file_srl` - , `item`.`screenshot_url` as `item_screenshot_url` - , `item`.`version` as `item_version` - , `item`.`voter` as `item_voter` - , `item`.`voted` as `item_voted` - , `item`.`downloaded` as `item_downloaded` - , `item`.`regdate` as `item_regdate` - , `files`.`source_filename` as `source_filename` - , `files`.`sid` as `sid` - from `xe_resource_packages` as `package` - , `xe_member` as `member` - , `xe_resource_items` as `item` - , `xe_files` as `files` - where (`package`.`status` = \'accepted\' - and `package`.`member_srl` = `member`.`member_srl` - and `item`.`item_srl` = `package`.`latest_item_srl` - and `package`.`update_order` <= 0 - and `files`.`file_srl` = `item`.`file_srl`) - and `package`.`update_order` <= 2100000000 - order by `package`.`update_order` asc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_Syndication_getGrantedModules() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/syndication.getGrantedModules.xml"; - $argsString = ''; - $expected = 'select `module_srl` - from `xe_module_grants` as `module_grants` - where `name` in (\'access\',\'view\',\'list\') - and (`group_srl` >= 1 or `group_srl` = -1 or `group_srl` = -2) group by `module_srl`'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_Like_Clause() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/opage.getOpageList.like.xml"; - $argsString = '$args->s_mid = "test";'; - $expected = 'select * - from `xe_modules` as `modules` - where `module` = \'opage\' - and (`mid` like \'%test%\') - order by `module_srl` desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_NotLike_Clause() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/opage.getOpageList.notlike.xml"; - $argsString = '$args->s_mid = "test";'; - $expected = 'select * - from `xe_modules` as `modules` - where `module` = \'opage\' - and (`mid` not like \'%test%\') - order by `module_srl` desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_NotLikeTail_Clause() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/opage.getOpageList.notliketail.xml"; - $argsString = '$args->s_mid = "test";'; - $expected = 'select * - from `xe_modules` as `modules` - where `module` = \'opage\' - and (`mid` not like \'%test\') - order by `module_srl` desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_NotLikePrefix_Clause() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/opage.getOpageList.notlikeprefix.xml"; - $argsString = '$args->s_mid = "test";'; - $expected = 'select * - from `xe_modules` as `modules` - where `module` = \'opage\' - and (`mid` not like \'test%\') - order by `module_srl` desc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_WidgetsNewestDocument_getNewestDocuments() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/widgets.newest_document.getNewestDocuments.xml"; - $argsString = '$args->module_srl = "566036,3777868";'; - $expected = 'select `modules`.`site_srl` as `site_srl` - , `modules`.`mid` as `mid` - , `documents`.* - from `xe_modules` as `modules` - , `xe_documents` as `documents` - where ( - `documents`.`module_srl` not in (0) - and `documents`.`module_srl` in (566036,3777868) - and `modules`.`module_srl` = `documents`.`module_srl`) - and `documents`.`list_order` <= 2100000000 - order by `documents`.`list_order` asc - limit 20'; - - $this->_test($xml_file, $argsString, $expected); - } - - function test_homepage_getNewestComments() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/homepage.getNewestComments.xml"; - $argsString = ';'; - $expected = 'select `sites`.`domain` as `domain` - , `comments`.* - from `xe_homepages` as `homepages` - , `xe_sites` as `sites` - , `xe_comments` as `comments` - , `xe_modules` as `modules` - left join `xe_module_grants` as `module_grants` - on `module_grants`.`module_srl` = `modules`.`module_srl` - and `module_grants`.`name` = \'access\' - and `module_grants`.`group_srl` not in (0,-1) - where (`homepages`.`site_srl` = `sites`.`site_srl` - and `homepages`.`site_srl` = `modules`.`site_srl` - and `comments`.`module_srl` = `modules`.`module_srl` - and `module_grants`.`group_srl` is null) - and `comments`.`list_order` <= 2100000000 - order by `comments`.`list_order` asc limit 0, 5'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_distinct_outer_join() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/distinct_outer_join.xml"; - $argsString = '$args->site_srl = 0;'; - $expected = 'select distinct `modules`.`module_srl` as `module_site_srl` - from `xe_sites` as `sites` - left join `xe_modules` as `modules` on `modules`.`module_srl` = `sites`.`index_module_srl` - where `sites`.`site_srl` = 0'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_getDocumentListWithinComment() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/document.getDocumentListWithinComment.xml"; - $argsString = '$args->module_srl = 19778968; - $args->s_comment = "dfsds"; - $args->statusList = "PUBLIC, SECRET"; - '; - $expected = 'select `documents`.`document_srl`, `documents`.`list_order` - from `xe_documents` as `documents` - , `xe_comments` as `comments` - where (`documents`.`module_srl` in (19778968) - and `documents`.`document_srl` = `comments`.`document_srl` - and `documents`.`status` in (\'public\',\'secret\') - and `comments`.`content` like \'%dfsds%\') - and `comments`.`list_order` <= 2100000000 - group by `documents`.`document_srl` - order by `comments`.`list_order` asc - limit 0, 20'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 2064 - * Queries should support both notin and not_in as valid operations - */ - function test_not_in() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/document.getNewestDocuments.xml"; - $argsString = '$args->module_srl = "345709,345710,345711,345728,345707,345670,345667,49113,16551,345679,50394,350665,345680,381846,381852,381917,345708,349028,345666,17173,49117,345671,345714,345665,349893,345696,345713,351967,330919,345685,16754,349027,348787,345672,350239,345697,345674,291882,345678,345729,345675,345721,345676,381867,294605,381864,345673,355113,353624,345681,345683,345668,345677,12424,158716,47498,101835,273679,142558,13818,12311,8723,78670,18919,365075,13833,14293,15891,27823,14291,177818,81000,11788,18918,13859,14102,14136,255783,134367,385619,317170,330312"; - $args->sort_index = "documents.list_order"; - $args->order_type = "asc"; - $args->list_count = 10; - '; - $expected = 'select `modules`.`site_srl` as `site_srl`, `modules`.`mid` as `mid`, `documents`.* from `xe_modules` as `modules`, `xe_documents` as `documents` where (`documents`.`module_srl` not in (0) and `documents`.`module_srl` in (345709,345710,345711,345728,345707,345670,345667,49113,16551,345679,50394,350665,345680,381846,381852,381917,345708,349028,345666,17173,49117,345671,345714,345665,349893,345696,345713,351967,330919,345685,16754,349027,348787,345672,350239,345697,345674,291882,345678,345729,345675,345721,345676,381867,294605,381864,345673,355113,353624,345681,345683,345668,345677,12424,158716,47498,101835,273679,142558,13818,12311,8723,78670,18919,365075,13833,14293,15891,27823,14291,177818,81000,11788,18918,13859,14102,14136,255783,134367,385619,317170,330312) and `modules`.`module_srl` = `documents`.`module_srl`) and `documents`.`list_order` <= 2100000000 order by `documents`.`list_order` asc limit 10'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 2064 - * Query condition should be ignored if operation is invalid - */ - function test_invalid_condition_operation() { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/document.getNewestDocumentsInvalid.xml"; - $argsString = '$args->module_srl = "345709,345710,345711,345728,345707,345670,345667,49113,16551,345679,50394,350665,345680,381846,381852,381917,345708,349028,345666,17173,49117,345671,345714,345665,349893,345696,345713,351967,330919,345685,16754,349027,348787,345672,350239,345697,345674,291882,345678,345729,345675,345721,345676,381867,294605,381864,345673,355113,353624,345681,345683,345668,345677,12424,158716,47498,101835,273679,142558,13818,12311,8723,78670,18919,365075,13833,14293,15891,27823,14291,177818,81000,11788,18918,13859,14102,14136,255783,134367,385619,317170,330312"; - $args->sort_index = "documents.list_order"; - $args->order_type = "asc"; - $args->list_count = 10; - '; - $expected = 'select `modules`.`site_srl` as `site_srl`, `modules`.`mid` as `mid`, `documents`.* from `xe_modules` as `modules`, `xe_documents` as `documents` where (`documents`.`module_srl` in (345709,345710,345711,345728,345707,345670,345667,49113,16551,345679,50394,350665,345680,381846,381852,381917,345708,349028,345666,17173,49117,345671,345714,345665,349893,345696,345713,351967,330919,345685,16754,349027,348787,345672,350239,345697,345674,291882,345678,345729,345675,345721,345676,381867,294605,381864,345673,355113,353624,345681,345683,345668,345677,12424,158716,47498,101835,273679,142558,13818,12311,8723,78670,18919,365075,13833,14293,15891,27823,14291,177818,81000,11788,18918,13859,14102,14136,255783,134367,385619,317170,330312) and `modules`.`module_srl` = `documents`.`module_srl`) and `documents`.`list_order` <= 2100000000 order by `documents`.`list_order` asc limit 10'; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 2114 - * 'Null' operation is ignored - */ - function test_null() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/page.pageTypeNullCheck.xml"; - $argsString = ' '; - $expected = 'select `m`.`module_srl`, `m`.`mid`, `ev`.`value` - from `xe_modules` as `m` - left join `xe_module_extra_vars` as `ev` - on `ev`.`name` = \'page_type\' - and `m`.`module_srl` = `ev`.`module_srl` - where `m`.`module` = \'page\' - and `ev`.`value` is null - '; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 2114 - * 'Notnull' operation is ignored - */ - function test_notnull() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/page.pageTypeNotNullCheck.xml"; - $argsString = ' '; - $expected = 'select `m`.`module_srl`, `m`.`mid`, `ev`.`value` - from `xe_modules` as `m` - left join `xe_module_extra_vars` as `ev` - on `ev`.`name` = \'page_type\' - and `m`.`module_srl` = `ev`.`module_srl` - where `m`.`module` = \'page\' - and `ev`.`value` is not null - '; - $this->_test($xml_file, $argsString, $expected); - } - - function testLikeWithDot() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/likewithdot.xml"; - $argsString = ''; - $expected = 'select * - from `xe_layouts` as `layouts` - where `site_srl` = 0 - and `layout_type` = \'p\' - and `layout` like \'%.%\''; - $this->_test($xml_file, $argsString, $expected); - - } - - - function testFromSubquery() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/from_subquery.xml"; - $argsString = ' - '; - $expected = 'SELECT `A`.`member_srl` as `member_srl`, COUNT(`A`.`cnt`) as `count` - FROM ( - SELECT `member_srl` as `member_srl`, count(*) AS `cnt` - FROM `xe_documents` as `documents` - GROUP BY `member_srl` - ) AS `A`'; - $this->_test($xml_file, $argsString, $expected); - } - - - /** - * Like with image extension - */ - function testLikeImageExtension() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/like_image_extension.xml"; - $argsString = ''; - $expected = "select `files`.`upload_target_srl` as `document_srl` - from `xe_files` as `files` - , `xe_documents` as `documents` - where ( - `files`.`upload_target_srl` = `documents`.`document_srl` - and (`files`.`source_filename` like '%.jpg' - or `files`.`source_filename` like '%.gif' - or `files`.`source_filename` like '%.png')) - and `documents`.`list_order` <= 2100000000 - group by `files`.`upload_target_srl` - order by `documents`.`list_order` asc - limit 5"; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Add support for CAST / CONVERT function - */ - function testCast() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/cast.xml"; - $argsString = ''; - $expected = "select cast(`document_srl` as unsigned integer) from `xe_documents` as `documents`"; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Add support for CAST / CONVERT function - */ - function testConvert() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/convert.xml"; - $argsString = ''; - $expected = "select convert(`document_srl`, unsigned integer) from `xe_documents` as `documents`"; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 1431 - xml click count error - */ - function testClickCount() - { - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/click_count.xml"; - $argsString = '$args->incr_expose_count = true;'; - $expected = "select `expose_count` from `xe_modules` as `modules`"; - $this->_test($xml_file, $argsString, $expected); - } -} diff --git a/tests/classes/db/db/xml_query/mysql/MysqlUpdateTest.php b/tests/classes/db/db/xml_query/mysql/MysqlUpdateTest.php deleted file mode 100644 index 5ba5799a8..000000000 --- a/tests/classes/db/db/xml_query/mysql/MysqlUpdateTest.php +++ /dev/null @@ -1,76 +0,0 @@ - */ - - class MysqlUpdateTest extends MysqlTest { - - function _test($xml_file, $argsString, $expected, $columnList = null){ - $this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql', $columnList); - } - - function test_document_updateDocumentStatus(){ - $xml_file = _XE_PATH_ . "modules/document/queries/updateDocumentStatus.xml"; - $argsString = '$args->is_secret = \'Y\'; - $args->status = \'SECRET\'; - '; - $expected = 'update `xe_documents` as `documents` set `status` = \'secret\' where `is_secret` = \'y\''; - $this->_test($xml_file, $argsString, $expected); - } - - /** - * Issue 388 - Query cache error related table alias - * http://code.google.com/p/xe-core/issues/detail?id=388 - */ - function test_importer_updateDocumentSync(){ - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/importer.updateDocumentSync.xml"; - $argsString = ''; - $expected = 'UPDATE `xe_documents` as `documents`, `xe_member` as `member` - SET `documents`.`member_srl` = `member`.`member_srl` - WHERE `documents`.`user_id` = `member`.`user_id` - '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_document_updateItemDownloadedCount(){ - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/document.updateItemDownloadedCount.xml"; - $argsString = '$args->module_srl = 10; $args->package_srl = 11; $args->item_srl = 12;'; - $expected = 'update `xe_resource_items` as `resource_items` - set `downloaded` = `downloaded` + 1 - where `module_srl` = 10 - and `package_srl` = 11 - and `item_srl` = 12 - '; - $this->_test($xml_file, $argsString, $expected); - } - - function test_menu_updateMenuItemListorder(){ - $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/menu.updateMenuItemListorder.xml"; - $argsString = '$args->menu_srl = 10; $args->parent_srl = 11; $args->listorder = 12;'; - $expected = 'update `xe_menu_item` as `menu_item` - set `listorder` = `listorder` - 1 - where `menu_srl` = 10 - and `parent_srl` = 11 - and `listorder` <= 12'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_communication_setMessageReaded(){ - $xml_file = _XE_PATH_ . "modules/communication/queries/setMessageReaded.xml"; - $argsString = '$args->message_srl = 339321; $args->related_srl = 339321;'; - $expected = 'update `xe_member_message` as `member_message` - set `readed` = \'y\' - , `readed_date` = \'' . date("YmdHis") . '\' - where `message_srl` = 339321 or `related_srl` = 339321'; - $this->_test($xml_file, $argsString, $expected); - } - - function test_session_updateSession(){ - $xml_file = _XE_PATH_ . "modules/session/queries/updateSession.xml"; - $argsString = '$args->session_key = 339321; $args->val = "yuhuu";'; - $expected = 'update `xe_session` as `session` - set `member_srl` = 0, `val` = \'yuhuu\' - , `ipaddress` = \''. $_SERVER['REMOTE_ADDR'] .'\' - , `last_update` = \'' . date("YmdHis") . '\' - where `session_key` = \'339321\''; - $this->_test($xml_file, $argsString, $expected); - } - } diff --git a/tests/classes/db/db/xml_query/mysql/data/cast.xml b/tests/classes/db/db/xml_query/mysql/data/cast.xml deleted file mode 100644 index 9049dbe1b..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/cast.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -
    - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/click_count.xml b/tests/classes/db/db/xml_query/mysql/data/click_count.xml deleted file mode 100644 index 3dd210b09..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/click_count.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -
    - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/convert.xml b/tests/classes/db/db/xml_query/mysql/data/convert.xml deleted file mode 100644 index 96d982717..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/convert.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -
    - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/distinct_outer_join.xml b/tests/classes/db/db/xml_query/mysql/data/distinct_outer_join.xml deleted file mode 100644 index 0c04f8a1a..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/distinct_outer_join.xml +++ /dev/null @@ -1,16 +0,0 @@ - - -
    -
    - - - -
    -
    - - - - - - -
    diff --git a/tests/classes/db/db/xml_query/mysql/data/document.getDocumentListWithinComment.xml b/tests/classes/db/db/xml_query/mysql/data/document.getDocumentListWithinComment.xml deleted file mode 100644 index 28f4a2c62..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/document.getDocumentListWithinComment.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocuments.xml b/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocuments.xml deleted file mode 100644 index e6e7ac7e4..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocuments.xml +++ /dev/null @@ -1,21 +0,0 @@ - - -
    -
    - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocumentsInvalid.xml b/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocumentsInvalid.xml deleted file mode 100644 index 5a3ad2aad..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/document.getNewestDocumentsInvalid.xml +++ /dev/null @@ -1,21 +0,0 @@ - - -
    -
    - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml b/tests/classes/db/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml deleted file mode 100644 index bebb488a1..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml +++ /dev/null @@ -1,13 +0,0 @@ - - -
    - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/from_subquery.xml b/tests/classes/db/db/xml_query/mysql/data/from_subquery.xml deleted file mode 100644 index f1918bcb3..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/from_subquery.xml +++ /dev/null @@ -1,20 +0,0 @@ - - -
    - -
    - - - - - - - - -
    -
    - - - - -
    \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/homepage.getNewestComments.xml b/tests/classes/db/db/xml_query/mysql/data/homepage.getNewestComments.xml deleted file mode 100644 index 9bf58ae90..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/homepage.getNewestComments.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - -
    -
    -
    -
    - - - - - -
    -
    - - - - - - - - - - - - - - - - -
    diff --git a/tests/classes/db/db/xml_query/mysql/data/importer.updateDocumentSync.xml b/tests/classes/db/db/xml_query/mysql/data/importer.updateDocumentSync.xml deleted file mode 100644 index a3351ac5d..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/importer.updateDocumentSync.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/index_hint_for_all.xml b/tests/classes/db/db/xml_query/mysql/data/index_hint_for_all.xml deleted file mode 100644 index b0784fa94..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/index_hint_for_all.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/insert_select.xml b/tests/classes/db/db/xml_query/mysql/data/insert_select.xml deleted file mode 100644 index 4abfd3754..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/insert_select.xml +++ /dev/null @@ -1,23 +0,0 @@ - - -
    - - - - - - - - -
    - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/like_image_extension.xml b/tests/classes/db/db/xml_query/mysql/data/like_image_extension.xml deleted file mode 100644 index 2be232bce..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/like_image_extension.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/likewithdot.xml b/tests/classes/db/db/xml_query/mysql/data/likewithdot.xml deleted file mode 100644 index 6a40c30a0..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/likewithdot.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/member_insert_injection.xml b/tests/classes/db/db/xml_query/mysql/data/member_insert_injection.xml deleted file mode 100644 index ab10e4b99..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/member_insert_injection.xml +++ /dev/null @@ -1,9 +0,0 @@ - - -
    - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/menu.updateMenuItemListorder.xml b/tests/classes/db/db/xml_query/mysql/data/menu.updateMenuItemListorder.xml deleted file mode 100644 index ced0e2640..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/menu.updateMenuItemListorder.xml +++ /dev/null @@ -1,13 +0,0 @@ - - -
    - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/one_index_hint_one_table.xml b/tests/classes/db/db/xml_query/mysql/data/one_index_hint_one_table.xml deleted file mode 100644 index c74defef5..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/one_index_hint_one_table.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.like.xml b/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.like.xml deleted file mode 100644 index 72c5cab1f..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.like.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlike.xml b/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlike.xml deleted file mode 100644 index 133884d23..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlike.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlikeprefix.xml b/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlikeprefix.xml deleted file mode 100644 index 19c45efb1..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notlikeprefix.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notliketail.xml b/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notliketail.xml deleted file mode 100644 index c32023fee..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/opage.getOpageList.notliketail.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNotNullCheck.xml b/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNotNullCheck.xml deleted file mode 100644 index bff829baa..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNotNullCheck.xml +++ /dev/null @@ -1,20 +0,0 @@ - - -
    -
    - - - - -
    -
    - - - - - - - - - -
    diff --git a/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNullCheck.xml b/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNullCheck.xml deleted file mode 100644 index 0fefc0f27..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/page.pageTypeNullCheck.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - -
    - - - - -
    -
    - - - - - - - - - -
    diff --git a/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItem.xml b/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItem.xml deleted file mode 100644 index f6fa06e83..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItem.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItemList.xml b/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItemList.xml deleted file mode 100644 index 041e30694..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/resource.getLatestItemList.xml +++ /dev/null @@ -1,60 +0,0 @@ - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/substring.xml b/tests/classes/db/db/xml_query/mysql/data/substring.xml deleted file mode 100644 index fef155bec..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/substring.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml b/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml deleted file mode 100644 index b5353f374..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
    - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/syndication.getGrantedModules.xml b/tests/classes/db/db/xml_query/mysql/data/syndication.getGrantedModules.xml deleted file mode 100644 index 97d2b4ec9..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/syndication.getGrantedModules.xml +++ /dev/null @@ -1,19 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables.xml b/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables.xml deleted file mode 100644 index 0c635583c..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables.xml +++ /dev/null @@ -1,14 +0,0 @@ - - -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables_combined.xml b/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables_combined.xml deleted file mode 100644 index 3981bebee..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/three_index_hints_two_tables_combined.xml +++ /dev/null @@ -1,14 +0,0 @@ - - -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/two_index_hints_one_table.xml b/tests/classes/db/db/xml_query/mysql/data/two_index_hints_one_table.xml deleted file mode 100644 index 9dec3a774..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/two_index_hints_one_table.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/widgets.newest_document.getNewestDocuments.xml b/tests/classes/db/db/xml_query/mysql/data/widgets.newest_document.getNewestDocuments.xml deleted file mode 100644 index b83244911..000000000 --- a/tests/classes/db/db/xml_query/mysql/data/widgets.newest_document.getNewestDocuments.xml +++ /dev/null @@ -1,21 +0,0 @@ - - -
    -
    - - - - - - - - - - - - - - - - - diff --git a/tests/classes/db/db/xml_query/sqlite/SqliteDeleteTest.php b/tests/classes/db/db/xml_query/sqlite/SqliteDeleteTest.php deleted file mode 100644 index 5bc3830fd..000000000 --- a/tests/classes/db/db/xml_query/sqlite/SqliteDeleteTest.php +++ /dev/null @@ -1,18 +0,0 @@ - */ - - class SqliteDeleteTest extends SqliteTest { - - function _test($xml_file, $argsString, $expected, $columnList = null){ - $this->_testQuery($xml_file, $argsString, $expected, 'getDeleteSql', $columnList); - } - - function testDeleteIsGeneratedWithoutAlias(){ - $xml_file = _TEST_PATH_ . "db/xml_query/sqlite/data/module.deleteModuleConfig.xml"; - $argsString = '$args->module = "comment"; $args->site_srl = 0; '; - $expected = 'delete from "xe_module_config" - where "module" = \'comment\' and "site_srl" = 0'; - $this->_test($xml_file, $argsString, $expected); - } - - } diff --git a/tests/classes/db/db/xml_query/sqlite/SqliteUpdateTest.php b/tests/classes/db/db/xml_query/sqlite/SqliteUpdateTest.php deleted file mode 100644 index 2ab9c149d..000000000 --- a/tests/classes/db/db/xml_query/sqlite/SqliteUpdateTest.php +++ /dev/null @@ -1,22 +0,0 @@ - */ - - class SqliteUpdateTest extends SqliteTest { - - function _test($xml_file, $argsString, $expected, $columnList = null){ - $this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql', $columnList); - } - - function testUpdateIsGeneratedWithoutAlias(){ - $xml_file = _TEST_PATH_ . "db/xml_query/sqlite/data/member.updateLastLogin.xml"; - $argsString = '$args->member_srl = 4; - $args->last_login = \'20111014184010\'; - '; - $expected = 'UPDATE "xe_member" - SET "member_srl" = 4 - , "last_login" = \'20111014184010\' - WHERE "member_srl" = 4'; - $this->_test($xml_file, $argsString, $expected); - } - - } diff --git a/tests/classes/db/db/xml_query/sqlite/data/member.updateLastLogin.xml b/tests/classes/db/db/xml_query/sqlite/data/member.updateLastLogin.xml deleted file mode 100644 index 3a8fde69d..000000000 --- a/tests/classes/db/db/xml_query/sqlite/data/member.updateLastLogin.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - - - - - - - - - \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/sqlite/data/module.deleteModuleConfig.xml b/tests/classes/db/db/xml_query/sqlite/data/module.deleteModuleConfig.xml deleted file mode 100644 index bdc99660b..000000000 --- a/tests/classes/db/db/xml_query/sqlite/data/module.deleteModuleConfig.xml +++ /dev/null @@ -1,9 +0,0 @@ - - -
    - - - - - - diff --git a/tests/classes/file/FileHandlerTest.php b/tests/classes/file/FileHandlerTest.php deleted file mode 100644 index 793a76fe6..000000000 --- a/tests/classes/file/FileHandlerTest.php +++ /dev/null @@ -1,81 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; - -require_once _XE_PATH_.'classes/file/FileHandler.class.php'; - -class FileHandlerTest extends PHPUnit_Framework_TestCase -{ - public function testGetRealPath() - { - $this->assertEquals(FileHandler::getRealPath(__FILE__), __FILE__); - $this->assertEquals(FileHandler::getRealPath('./tests/classes/file/FileHandlerTest.php'), __FILE__); - } - - public function testFileMethods() - { - $mock = dirname(__FILE__).'/mock.txt'; - $mock2 = dirname(__FILE__).'/mock2.txt'; - touch($mock); - - // copy file - $this->assertTrue(is_readable($mock)); - FileHandler::copyFile($mock, $mock2); - $this->assertTrue(is_readable($mock2)); - - // remove file - $this->assertTrue(FileHandler::removeFile($mock2)); - $this->assertFalse(is_readable($mock2)); - $this->assertFalse(FileHandler::removeFile($mock2)); - - // rename file - $this->assertTrue(FileHandler::rename($mock, $mock2)); - $this->assertFalse(is_readable($mock)); - $this->assertTrue(is_readable($mock2)); - $this->assertFalse(FileHandler::rename($mock, $mock2)); - - // move file - $this->assertTrue(FileHandler::rename($mock2, $mock)); - $this->assertTrue(is_readable($mock)); - $this->assertFalse(is_readable($mock2)); - $this->assertTrue(touch($mock2) && is_readable($mock2)); - $this->assertTrue(FileHandler::moveFile($mock, $mock2)); - $this->assertFalse(is_readable($mock)); - $this->assertTrue(is_readable($mock2)); - - // remove file - $this->assertFalse(FileHandler::removeFile($mock)); - $this->assertTrue(FileHandler::removeFile($mock2)); - $this->assertFalse(is_readable($mock)); - $this->assertFalse(is_readable($mock2)); - } - - public function testFileSize() - { - // file size - $this->assertEquals(FileHandler::filesize(0), '0Byte'); - $this->assertEquals(FileHandler::filesize(1), '1Byte'); - $this->assertEquals(FileHandler::filesize(386), '386Bytes'); - $this->assertEquals(FileHandler::filesize(1023), '1023Bytes'); - $this->assertEquals(FileHandler::filesize(1024), '1.0KB'); - $this->assertEquals(FileHandler::filesize(2480), '2.4KB'); - $this->assertEquals(FileHandler::filesize(1024*1024-1), '1024.0KB'); - $this->assertEquals(FileHandler::filesize(1024*1024), '1.00MB'); - $this->assertEquals(FileHandler::filesize(3*1024*1024+210*1024), '3.21MB'); - - // return bytes - $this->assertEquals(FileHandler::returnBytes('0B'), 0); - $this->assertEquals(FileHandler::returnBytes('1024B'), 1024); - $this->assertEquals(FileHandler::returnBytes('1K'), 1024); - $this->assertEquals(FileHandler::returnBytes('102.48K'), 1024*102.48); - $this->assertEquals(FileHandler::returnBytes('1M'), 1024*1024); - $this->assertEquals(FileHandler::returnBytes('1.12M'), 1024*1024*1.12); - $this->assertEquals(FileHandler::returnBytes('1023.99M'), 1024*1024*1023.99); - $this->assertEquals(FileHandler::returnBytes('1G'), 1024*1024*1024); - $this->assertEquals(FileHandler::returnBytes('12.02G'), 1024*1024*1024*12.02); - } -} - -/* End of file FileHandlerTest.php */ -/* Location: ./tests/classes/file/FileHandlerTest.php */ diff --git a/tests/classes/frontendfile/FrontEndFileHandlerTest.php b/tests/classes/frontendfile/FrontEndFileHandlerTest.php deleted file mode 100644 index 439b11202..000000000 --- a/tests/classes/frontendfile/FrontEndFileHandlerTest.php +++ /dev/null @@ -1,223 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; - -require_once _XE_PATH_.'classes/handler/Handler.class.php'; -require_once _XE_PATH_.'classes/frontendfile/FrontEndFileHandler.class.php'; -require_once _XE_PATH_.'classes/file/FileHandler.class.php'; - - -class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase -{ - public function testHandler() - { - Context::setUseCdn('Y'); - Context::setRequestUrl('http://test.com'); - - $handler = new FrontEndFileHandler(); - - // js(head) - $handler->loadFile(array('./common/js/jquery.min.js')); - $handler->loadFile(array('./common/js/js_app.js')); - $handler->loadFile(array('./common/js/common.js')); - $handler->loadFile(array('./common/js/xml_handler.js')); - $handler->loadFile(array('./common/js/xml_js_filter.js')); - - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/js_app.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_handler.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js', 'targetie' => ''); - $this->assertEquals($handler->getJsFileList(), $expected); - - unset($handler); - unset($expected); - $handler = new FrontEndFileHandler(); - - // js(body) - $handler->loadFile(array('./common/js/jquery.js', 'body')); - $handler->loadFile(array('./common/js/js_app.js', 'body')); - $handler->loadFile(array('./common/js/common.js', 'body')); - $handler->loadFile(array('./common/js/xml_handler.js', 'body')); - $handler->loadFile(array('./common/js/xml_js_filter.js', 'body')); - - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/js_app.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_handler.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js', 'targetie' => ''); - $this->assertEquals($handler->getJsFileList('body'), $expected); - - unset($handler); - unset($expected); - $handler = new FrontEndFileHandler(); - - // css - $handler->loadFile(array('./common/css/xe.css')); - $handler->loadFile(array('./common/css/common.css')); - - $expected[] = array('file' => '/xe/common/css/xe.css', 'media' => 'all', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/css/common.css', 'media' => 'all', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - unset($handler); - unset($expected); - $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)); - - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/js_app.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_handler.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js', 'targetie' => ''); - $this->assertEquals($handler->getJsFileList(), $expected); - - // order (redefine) - unset($handler); - unset($expected); - $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', '', 1)); - - $expected[] = array('file' => '/xe/common/js/js_app.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_handler.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => ''); - $this->assertEquals($handler->getJsFileList(), $expected); - - // unload - unset($handler); - unset($expected); - $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', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_handler.js', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/js/xml_js_filter.js', 'targetie' => ''); - $this->assertEquals($handler->getJsFileList(), $expected); - - // target IE(js) - unset($handler); - unset($expected); - $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')); - - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => 'ie6'); - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => 'ie7'); - $expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => 'ie8'); - $this->assertEquals($handler->getJsFileList(), $expected); - - // target IE(css) - unset($handler); - unset($expected); - $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); - - // media - unset($handler); - unset($expected); - $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' => ''); - $expected[] = array('file' => '/xe/common/css/common.css','media'=>'screen', 'targetie' => ''); - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'handled', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - // CDN - unset($handler); - unset($expected); - $handler = new FrontEndFileHandler(); - - $handler->loadFile(array('./common/css/common.css'), true, 'http://static.xpressengine.com/core/', 'v'); - - $expected[] = array('file' => 'http://static.xpressengine.com/core/v/common/css/common.css', 'media'=>'all', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - // CDN(no cdn setting) - unset($handler); - unset($expected); - Context::setUseCdn('N'); - $handler = new FrontEndFileHandler(); - - $handler->loadFile(array('./common/css/common.css'), true, 'http://static.xpressengine.com/core/', 'v'); - - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - // CDN(use ssl) - unset($handler); - unset($expected); - Context::setUseCdn('Y'); - Context::setRequestUrl('https://test.com'); - $handler = new FrontEndFileHandler(); - - $handler->loadFile(array('./common/css/common.css'), true, 'http://static.xpressengine.com/core/', 'v'); - - $expected[] = array('file' => '/xe/common/css/common.css', 'media'=>'all', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - // external file - unset($handler); - unset($expected); - Context::setUseCdn('Y'); - Context::setRequestUrl('http://test.com'); - $handler = new FrontEndFileHandler(); - - $handler->loadFile(array('http://external.com/css/style2.css')); - $handler->loadFile(array('http://external.com/css/style.css'), true, 'http://static.xpressengine.com/core/', 'v'); - - $expected[] = array('file' => 'http://external.com/css/style2.css', 'media'=>'all', 'targetie' => ''); - $expected[] = array('file' => 'http://external.com/css/style.css', 'media'=>'all', 'targetie' => ''); - $this->assertEquals($handler->getCssFileList(), $expected); - - } -} - -if(!class_exists('Context')) -{ - require _XE_PATH_.'/tests/classes/context/Context.mock.php'; -} - -if(!function_exists('debugPrint')) -{ - function debugPrint(){} -} diff --git a/tests/classes/security/SecurityTest.php b/tests/classes/security/SecurityTest.php deleted file mode 100644 index 793bfb903..000000000 --- a/tests/classes/security/SecurityTest.php +++ /dev/null @@ -1,135 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; - -require_once _XE_PATH_.'/classes/security/Security.class.php'; - -error_reporting(E_ALL & ~E_NOTICE); - -class SecurityTest extends PHPUnit_Framework_TestCase -{ - protected function setUp() - { - /** - * Setup mock data - **/ - - // string - Context::set('content1', 'Hello, world'); - Context::set('content2', 'Wow, >_< !'); - - // object - $args = new stdClass; - $args->prop1 = 'Normal string'; - $args->prop2 = 'He said, "Very nice!"'; - $args->prop3 = 'Strong Baby'; - Context::set('object1', $args); - - // array - $arr = array(); - $arr[] = 'First'; - $arr[] = 'Second'; - $arr[] = 'Third'; - Context::set('array1', $arr); - - // associative array - $aarr = array(); - $aarr['elem1'] = 'One 1'; - $aarr['elem2'] = 'Two 2'; - $aarr['elem3'] = 'Three 3'; - Context::set('array2', $aarr); - } - - public function testEncodeHTML_DefaultContext() - { - $security = new Security(); - - // normal string - one - $this->setUp(); - $this->assertEquals('Hello, world', Context::get('content1')); - $security->encodeHTML('content1'); - $this->assertEquals('<strong>Hello, world</strong>', Context::get('content1')); - - // normal string - two - $this->setUp(); - $this->assertEquals('Hello, world', Context::get('content1')); - $this->assertEquals('Wow, >_< !', Context::get('content2')); - $security->encodeHTML('content1','content2'); - $this->assertEquals('<strong>Hello, world</strong>', Context::get('content1')); - $this->assertEquals('Wow, >_< !', Context::get('content2')); - - // array - $this->assertEquals(Context::get('array1'), array('First','Second','Third')); - $security->encodeHTML('array1'); // should ignore this - $this->assertEquals(Context::get('array1'), array('First','Second','Third')); - $security->encodeHTML('array1.0'); // affect only first element - $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','Second','Third')); - $security->encodeHTML('array1.2'); // affects only third element - $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','Second','<b>T</b>hird')); - $this->setUp(); // reset; - $this->assertEquals(Context::get('array1'), array('First','Second','Third')); - $security->encodeHTML('array1.'); // affects all items - $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird')); - - // associated array - $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); - $security->encodeHTML('array2'); // should ignore this - $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); - $security->encodeHTML('array2.0'); // should ignore this - $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); - $security->encodeHTML('array2.elem2'); // affects only 'elem2' - $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two <del>2</del>','elem3'=>'Three 3')); - $this->setUp(); // reset; - $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); - $security->encodeHTML('array2.'); // affects all items - $this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>')); - - // object - $obj = new stdClass; - $obj->prop1 = 'Normal string'; - $obj->prop2 = 'He said, "Very nice!"'; - $obj->prop3 = 'Strong Baby'; - $this->assertEquals(Context::get('object1'), $obj); - $security->encodeHTML('object1'); // should ignore this - $this->assertEquals(Context::get('object1'), $obj); - $security->encodeHTML('object1.0'); // should ignore this - $this->assertEquals(Context::get('object1'), $obj); - $security->encodeHTML('object1.prop1'); // affects only 'prop1' property - no changes - $this->assertEquals(Context::get('object1'), $obj); - $security->encodeHTML('object1.prop3'); // affects only 'prop3' property - $obj->prop3 = '<strong>Strong</strong> Baby'; - $this->assertEquals(Context::get('object1'), $obj); - $this->setUp(); // reset - $obj->prop3 = 'Strong Baby'; - $this->assertEquals(Context::get('object1'), $obj); - $security->encodeHTML('object1.'); // affects all properties - $obj->prop2 = 'He said, "Very nice!"'; - $obj->prop3 = '<strong>Strong</strong> Baby'; - $this->assertEquals(Context::get('object1'), $obj); - } - - public function testEncodeHTML_CustomContext() - { - $array = array('Hello', 'World', 'Bold is not bald'); - - // array with no nested objects or arrays - $security = new Security($array); - $returned = $security->encodeHTML('.'); - $this->assertEquals($returned, array('Hello', 'World', '<b>Bold</b> is not bald')); - - // associative array - $array = array('first'=>'Hello', 'second'=>'World', '3rd'=>'Bold is not bald'); - $security = new Security($array); - $returned = $security->encodeHTML('first','3rd'); - $this->assertEquals($returned, array('first'=>'Hello', 'second'=>'World', '3rd'=>'<b>Bold</b> is not bald')); - } -} - -if(!class_exists('Context')) -{ - require _XE_PATH_.'/tests/classes/context/Context.mock.php'; -} - -/* End of file SecurityTest.php */ -/* Location: ./tests/classes/security/SecurityTest.php */ diff --git a/tests/classes/template/TemplateHandlerTest.php b/tests/classes/template/TemplateHandlerTest.php deleted file mode 100644 index a377f0eee..000000000 --- a/tests/classes/template/TemplateHandlerTest.php +++ /dev/null @@ -1,268 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; - -require_once _XE_PATH_.'classes/file/FileHandler.class.php'; -require_once _XE_PATH_.'classes/template/TemplateHandler.class.php'; - -class TemplateHandlerTest extends PHPUnit_Framework_TestCase -{ - var $prefix = ''; - - static public function provider() - { - return array( - // pipe cond - array( - 'Link', - 'cond > 10){ ?> class="active">Link' - ), - // cond - array( - 'Link1say, hello', - 'Link1cond){ ?>say, hello' - ), - // cond - array( - 'Link1Link2', - 'Link1v==$__Context->k){ ?>Link2' - ), - // for loop - array( - '', - '
      i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
    • Link
    ' - ), - // foreach loop - array( - '', - '
      arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
    • Link
        arr2&&count($__Context->arr2))foreach($__Context->arr2 as $__Context->key2=>$__Context->val2){ ?>
    ' - ), - // while loop - array( - '', - '
      item=get_loop_item()){ ?>
    • Link
    ' - ), - // ~ - array( - 'LinkHello, world', - 'Linkcond){ ?>Hello, world ' - ), - // ~ - array( - 'LinkHello, {$world}', - 'Linkcond){ ?>Hello, world ?>' - ), - // ~ ~ - array( - 'LinkHello, worldWow', - 'Linkcond){ ?>Hello, worldWow' - ), - // ~ ~ ~ - array( - 'LinkHello, worldHaHaWow', - 'Linkcond){ ?>Hello, worldcond2){ ?>HaHaWow' - ), - // ~ - array( - '
  • Repeat this
  • ', - 'i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
  • Repeat this
  • ' - ), - // ~ - array( - '
  • item{$key} : {$val}
  • ', - 'arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
  • itemkey ?> : val ?>
  • ' - ), - // ~ - array( - '{$v->text}', - 'item=$__Context->list->getItem()){ ?>v->text ?>' - ), - // ~ ~ ~ ~ - array( - ' A BC', - 'var){ ?> ABC' - ), - // invalid block statement - array( - '', - '' - ), - // {@ ...PHP_CODE...} - array( - '{@$list_page = $page_no}', - 'list_page = $__Context->page_no ?>' - ), - // %load_js_plugin - array( - '', - '' - ), - // #include - array( - '
    This is another dummy
    ', - 'compile(\'tests/classes/template\',\'sample.html\') ?>
    This is another dummy
    ' - ), - // - array( - '
    This is another dummy
    ', - 'compile(\'tests/classes\',\'sample.html\') ?>
    This is another dummy
    ' - ), - // - array( - '', - '' - ), - // - array( - '', - '' - ), - // - array( - '', - '' - ), - // - array( - '', - 'compile(); ?>' - ), - // - array( - '', - '' - ), - // - array( - '', - '' - ), - // comment - array( - '', - '' - ), - // self-closing tag - array( - '', - 'foo){ ?>' - ), - // relative path1 - array( - '', - '' - ), - // relative path2 - array( - '', - '' - ), - // error case - array( - 'logo', - 'layout_info->logo_image){ ?>logo' - ), - // error case - ignore stylesheets - array( - '', - '' - ), - // error case - ignore json - array( - '', - '' - ), - // error case - inline javascript - array( - '
    ', - '
    ' - ), - // issue 103 - array( - '', - '' - ), - // issue 135 - array( - '

    {$key}

    Loop block {$val}
    ', - '_m_list_all&&count($__Context->_m_list_all))foreach($__Context->_m_list_all as $__Context->key=>$__Context->val){ ?>

    key ?>

    Loop block val ?>
    ' - ), - // issue 136 - array( - '
    bar', - 'var==\'foo\'){ ?>
    bar' - ), - // issue 188 - array( - '
    Hello, world!
    ', - 'ii < $__Context->nn){ ?>dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' - ), - // issue 190 - array( - '
    Hello, world!
    ', - 'i >= $__Context->n)){ ?>dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' - ), - // issue 183 - array( - '
    '."\n".'
    {$vvv}
    CD
    ', - 'vvvls&&count($__Context->vvvls))foreach($__Context->vvvls as $__Context->vvv){ ?>'."\n".'
    vvv ?>
    CD
    ' - ), - // issue 512 - ignores - array( - '
    {$lang->sl_show_topimgtext}
    ', - '
    lang->sl_show_topimgtext ?>
    ' - ), - // issue 584 - array( - 'mobile', - 'oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?>mobile' - ), - // issue 831 - array( - "
  • class=\"on\">", - "
  • act, array(\n'dispNmsAdminGroupList',\n'dispNmsAdminInsertGroup',\n'dispNmsAdminGroupInfo',\n'dispNmsAdminDeleteGroup'))){ ?>class=\"on\">" - ), - // issue 746 - array( - '', - '' - ), - // issue 696 - array( - '{@ eval(\'$val = $document_srl;\')}', - 'val = $__Context->document_srl;\') ?>' - ), - ); - } - - /** - * @dataProvider provider - */ - public function testParse($tpl, $expected) - { - $tmpl = TemplateHandler::getInstance(); - $tmpl->init(dirname(__FILE__), 'sample.html'); - $result = $tmpl->parse($tpl); - - $this->assertEquals($result, $this->prefix.$expected); - } - - public function testParse2() - { - $tmpl = TemplateHandler::getInstance(); - $tmpl->init(dirname(__FILE__), 'no_file.html'); - - $result = $tmpl->parse(); - $this->assertEquals($result, ''); - } - - public function testCompileDirect() - { - $tmpl = TemplateHandler::getInstance(); - $result = $tmpl->compileDirect(dirname(__FILE__), 'sample.html'); - $result = trim($result); - - $this->assertEquals($result, $this->prefix.'has_blog){ ?>Taggon\'s blog'); - } -} diff --git a/tests/classes/validator/ValidatorTest.php b/tests/classes/validator/ValidatorTest.php deleted file mode 100644 index c5d7d9bcb..000000000 --- a/tests/classes/validator/ValidatorTest.php +++ /dev/null @@ -1,239 +0,0 @@ - */ - -if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php'; -require_once _XE_PATH_.'classes/xml/XmlParser.class.php'; -require_once _XE_PATH_.'classes/handler/Handler.class.php'; -require_once _XE_PATH_.'classes/file/FileHandler.class.php'; -require_once _XE_PATH_.'classes/validator/Validator.class.php'; - -class ValidatorTest extends PHPUnit_Framework_TestCase -{ - protected function setUp() { - global $lang; - - $lang->filter = new stdClass; - $lang->filter->isnull = 'isnull'; - $lang->filter->outofrange = 'outofrange'; - $lang->filter->equalto = 'equalto'; - } - - public function testRequired() { - $vd = new Validator(); - $vd->addFilter('userid', array('required'=>'true')); - - // given data - $this->assertFalse( $vd->validate(array('no-userid'=>'hello')) ); - $this->assertTrue( $vd->validate(array('userid'=>'myuserid')) ); - $this->assertFalse( $vd->validate(array('userid'=>'')) ); - - // context data - $this->assertFalse( $vd->validate() ); - Context::set('userid', '', true); - $this->assertFalse( $vd->validate() ); - Context::set('userid', 'myuserid', true); - $this->assertTrue( $vd->validate() ); - $vd->removeFilter('userid'); - $this->assertTrue( $vd->validate() ); - } - - public function testNamePattern() { - $vd = new Validator(); - $vd->addFilter('^user_', array('length'=>'5:')); - - Context::set('user_123', 'abcd', true); - Context::set('user_456', '123', true); - $this->assertFalse( $vd->validate() ); - - Context::set('user_123', 'abcdefg', true); - $this->assertFalse( $vd->validate() ); - - Context::set('user_456', '123456', true); - $this->assertTrue( $vd->validate() ); - } - - public function testEqualTo() { - $vd = new Validator(); - $vd->addFilter('pass1', array('equalto'=>'pass2')); - - Context::set('pass1', 'MyPassword', true); - $this->assertFalse( $vd->validate() ); - Context::set('pass2', 'WorngPassword', true); - $this->assertFalse( $vd->validate() ); - Context::set('pass2', 'MyPassword', true); - $this->assertTrue( $vd->validate() ); - } - - public function testArrayTrim() { - $vd = new Validator(); - - $arr = array('red'=>'apple', 'yellow'=>'banana ', 'green'=>' papaya '); - $this->assertEquals($vd->arrayTrim($arr), array('red'=>'apple', 'yellow'=>'banana', 'green'=>'papaya')); - $this->assertEquals($vd->arrayTrim(' string '), 'string'); - } - - public function testDefault() { - $vd = new Validator(); - $vd->addFilter('userid', array('default'=>'ididid')); - - // given data - $arr = array('no-userid'=>''); - $vd->validate($arr); - $this->assertEquals( $arr, array('no-userid'=>'') ); - - $arr = array('userid'=>''); - $vd->validate(&$arr); // pass-by-reference - $this->assertEquals( $arr, array('userid'=>'ididid') ); - - $arr = array('userid'=>'ownid'); - $vd->validate(&$arr); - $this->assertEquals( $arr, array('userid'=>'ownid') ); - - if(defined('MOCK_CONTEXT')) { - Context::truncate(); - - // context data - $vd->validate(); - $this->assertEquals( 'ididid', Context::get('userid') ); - - } - - $vd->load(dirname(__FILE__).'/login.xml'); - - Context::set('userid', '', true); - $vd->validate(); - $this->assertEquals( 'idididid', Context::get('userid') ); - } - - public function testLength() { - $vd = new Validator(); - - $vd->addFilter('field1', array('length'=>'3:')); - $this->assertFalse( $vd->validate(array('field1'=>'ab')) ); - $this->assertTrue( $vd->validate(array('field1'=>'abc')) ); - $this->assertTrue( $vd->validate(array('field1'=>'abcd')) ); - } - - public function testCustomRule() { - // regex - $vd = new Validator(); - $customRules['regex_rule']['type'] = 'regex'; - $customRules['regex_rule']['test'] = '/^[a-z]+$/'; - $vd->addRule($customRules); - $vd->addFilter('regex_field', array('rule' => 'regex_rule')); - - $this->assertTrue($vd->validate(array('regex_field' => 'abc'))); - $this->assertFalse($vd->validate(array('regex_field' => 'ABC'))); - - // enum - $vd = new Validator(); - $customRules['enum_rule']['type'] = 'enum'; - $customRules['enum_rule']['test'] = 'a,b,c'; - $vd->addRule($customRules); - $vd->addFilter('enum_field', array('rule' => 'enum_rule')); - - $this->assertTrue($vd->validate(array('enum_field' => 'a'))); - $this->assertFalse($vd->validate(array('enum_field' => 'd'))); - - // enum with custom delimiter - $vd = new Validator(); - $customRules['enum_rule2']['type'] = 'enum'; - $customRules['enum_rule2']['test'] = 'a@b@c'; - $customRules['enum_rule2']['delim'] = '@'; - $vd->addRule($customRules); - $vd->addFilter('enum_field2', array('rule' => 'enum_rule2')); - - $this->assertTrue($vd->validate(array('enum_field2' => 'a'))); - $this->assertFalse($vd->validate(array('enum_field2' => 'd'))); - - // expr - $vd = new Validator(); - $customRules['expr_rule']['type'] = 'expr'; - $customRules['expr_rule']['test'] = '$$ < 10'; - $vd->addRule($customRules); - $vd->addFilter('expr_field', array('rule' => 'expr_rule')); - - $this->assertTrue($vd->validate(array('expr_field' => '5'))); - $this->assertFalse($vd->validate(array('expr_field' => '15'))); - } - - public function testCustomRuleXml() - { - $vd = new Validator(dirname(__FILE__).'/customrule.xml'); - - $this->assertTrue($vd->validate(array('regex_field' => 'abc'))); - $this->assertFalse($vd->validate(array('regex_field' => 'ABC'))); - - $this->assertTrue($vd->validate(array('enum_field' => 'a'))); - $this->assertFalse($vd->validate(array('enum_field' => 'd'))); - - $this->assertTrue($vd->validate(array('enum_field2' => 'a'))); - $this->assertFalse($vd->validate(array('enum_field2' => 'd'))); - - $this->assertTrue($vd->validate(array('expr_field' => '5'))); - $this->assertFalse($vd->validate(array('expr_field' => '15'))); - } - - public function testCondition() { - $vd = new Validator(); - $data = array('greeting1'=>'hello'); - - // No condition - $vd->addFilter('greeting1', array('required'=>'true')); - $this->assertTrue($vd->validate($data)); - - // Now greeting2 being mandatory if greeting1 is 'Hello' - $vd->addFilter('greeting2', array('if'=>array('test'=>'$greeting1 == "Hello"', 'attr'=>'required', 'value'=>'true'))); - - // Because greeting1 is 'hello', including lowercase 'h', greeting2 isn't required yet. - $this->assertTrue($vd->validate($data)); - - // Change the value of greeting1. Greeting2 is required now - $data['greeting1'] = 'Hello'; - $this->assertFalse($vd->validate($data)); - - $data['greeting2'] = 'World'; - $this->assertTrue($vd->validate($data)); - } - - public function testConditionXml() { - - $vd = new Validator(dirname(__FILE__).'/condition.xml'); - $data = array('greeting1'=>'hello'); - - $this->assertTrue($vd->validate($data)); - - // Change the value of greeting1. Greeting2 is required now - $data['greeting1'] = 'Hello'; - $this->assertFalse($vd->validate($data)); - - $data['greeting2'] = 'World'; - $this->assertTrue($vd->validate($data)); - - // javascript - $vd->setCacheDir(dirname(__FILE__)); - $js = $vd->getJsPath(); - $this->assertFileEquals($js, dirname(__FILE__).'/condition.en.js'); - } - - protected function tearDown() - { - // remove cache directory - $cache_dir = dirname(__FILE__).'/ruleset'; - if(is_dir($cache_dir)) { - $files = (array)glob($cache_dir.'/*'); - foreach($files as $file) { - unlink($file); - } - rmdir($cache_dir); - } - } -} - -if(!class_exists('Context')) -{ - require _XE_PATH_.'tests/classes/context/Context.mock.php'; -} - -/* End of file ValidatorTest.php */ -/* Location: ./tests/classes/validator/ValidatorTest.php */ diff --git a/tests/common/js/index.html b/tests/common/js/index.html deleted file mode 100644 index f4d691853..000000000 --- a/tests/common/js/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - -

    Common JavaScript Test

    -

    -
    -

    -
      -
      - -
      -
      -
      - Legend - - - - - - -
      -
      -
      - - - diff --git a/tests/common/js/js_app.test.js b/tests/common/js/js_app.test.js deleted file mode 100644 index 896a05b44..000000000 --- a/tests/common/js/js_app.test.js +++ /dev/null @@ -1,105 +0,0 @@ -jQuery(function($){ - module('JAF'); - - var App = xe.createApp('App', { - value : 1, - init : function() { - this.value = 2; - }, - API_GET_VALUE : function(sender, params) { - return this.value; - }, - API_SET_VALUE : function(sender, params) { - this.value = params[0]; - } - }); - - var Plugin = xe.createPlugin('Plugin', { - API_BEFORE_GET_VALUE : function(sender, params) { - if (params[0]) return false; - }, - API_BEFORE_SET_VALUE : function(sender, params) { - params[0] = params[0] * 3; - }, - API_METHOD : function(sender, params) { - $('#plugin-test').html(params[0]); - } - }); - - test('Global object - xe', function(){ - equal(xe.getName(), 'Core'); - ok($.isFunction(xe.createApp), 'xe has createApp method'); - ok($.isFunction(xe.createPlugin), 'xe has createPlugin method'); - ok($.isFunction(xe.getApps), 'xe has getApps method'); - ok($.isFunction(xe.getApp), 'xe has getApp method'); - ok($.isFunction(xe.registerApp), 'xe has registerApp method'); - ok($.isFunction(xe.unregisterApp), 'xe has unregisterApp method'); - ok($.isFunction(xe.broadcast), 'xe has broadcast method'); - }); - test('App', function() { - var app1 = new App(); - - equal(app1.getName(), 'App', 'The app1 is an instance of App.'); - ok(xe.getApp('App') == null, 'The app1 is NOT registered yet.'); - - xe.registerApp(app1); - - ok(xe.getApp('App')[0] === app1, 'The app1 is registered successfully.'); - equal(app1.cast('GET_VALUE'), 2); - - xe.unregisterApp(app1); - - ok(xe.getApp('App') == null, 'The app1 is unregistered.'); - }); - test('Plugin', function() { - xe.registerApp(new App()); - - var plugin1 = new Plugin(); - - equal(plugin1.getName(), 'Plugin', 'The plugin1 is an instance of Plugin.'); - - var app1 = xe.getApp('App')[0]; - - app1.registerPlugin(plugin1); - - ok(typeof app1.cast('GET_VALUE', [true]) == 'undefined', 'Stop GET_VALUE action'); - - var val = app1.cast('GET_VALUE'); - equal(app1.cast('GET_VALUE'), val, 'Check current value'); - - app1.cast('SET_VALUE', [3]); - equal(app1.cast('GET_VALUE'), 9, 'Before hooker should change input value 3 into'); - - // original method - var obj = $('#plugin-test'); - equal(obj.html(), '', 'There is no content'); - - app1.cast('METHOD', ['hello']); - equal(obj.html(), 'hello', 'The plugin set the content'); - - obj.hide(); - - xe.unregisterApp(app1); - }); - test('Function : You can register a function as a message handler', function() { - xe.registerApp(new App()); - - function handler(sender, params) { - params[0] = params[0] + ', world!'; - } - - var app1 = xe.getApp('App')[0]; - app1.registerPlugin(new Plugin()); - - var obj = $('#plugin-test'); - app1.cast('METHOD', ['Hello']); - equal(obj.html(), 'Hello', 'The plugin set the content'); - - app1.registerHandler('BEFORE_METHOD', handler); - app1.cast('METHOD', ['Hello']); - equal(obj.html(), 'Hello, world!', 'The handler function changes a passed parameter.'); - - xe.unregisterApp(app1); - }); - -}); diff --git a/tests/common/js/qunit.css b/tests/common/js/qunit.css deleted file mode 100644 index 5da9cb48c..000000000 --- a/tests/common/js/qunit.css +++ /dev/null @@ -1,228 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Fri Sep 2 02:15:01 UTC 2011 - * Last Commit: 7f292170fa1109f1355f3e96f8973c32fc553946 - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #0d3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - - border-radius: 15px 15px 0 0; - -moz-border-radius: 15px 15px 0 0; - -webkit-border-top-right-radius: 15px; - -webkit-border-top-left-radius: 15px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #eee; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2b81af; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #c2ccd1; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests ol { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 15px; - -moz-border-radius: 15px; - -webkit-border-radius: 15px; - - box-shadow: inset 0px 2px 13px #999; - -moz-box-shadow: inset 0px 2px 13px #999; - -webkit-box-shadow: inset 0px 2px 13px #999; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - margin: 0.5em; - padding: 0.4em 0.5em 0.4em 0.5em; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #5E740B; - background-color: #fff; - border-left: 26px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 26px solid #EE5757; - white-space: pre; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 15px 15px; - -moz-border-radius: 0 0 15px 15px; - -webkit-border-bottom-right-radius: 15px; - -webkit-border-bottom-left-radius: 15px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2b81af; - background-color: #D2E0E6; - - border-bottom: 1px solid white; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; -} diff --git a/tests/common/js/qunit.js b/tests/common/js/qunit.js deleted file mode 100644 index f8d2a6850..000000000 --- a/tests/common/js/qunit.js +++ /dev/null @@ -1,1512 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Fri Sep 2 02:15:01 UTC 2011 - * Last Commit: 7f292170fa1109f1355f3e96f8973c32fc553946 - */ - -(function(window) { - -var defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - try { - return !!sessionStorage.getItem; - } catch(e) { - return false; - } - })() -}; - -var testId = 0; - -var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { - this.name = name; - this.testName = testName; - this.expected = expected; - this.testEnvironmentArg = testEnvironmentArg; - this.async = async; - this.callback = callback; - this.assertions = []; -}; -Test.prototype = { - init: function() { - var tests = id("qunit-tests"); - if (tests) { - var b = document.createElement("strong"); - b.innerHTML = "Running " + this.name; - var li = document.createElement("li"); - li.appendChild( b ); - li.className = "running"; - li.id = this.id = "test-output" + testId++; - tests.appendChild( li ); - } - }, - setup: function() { - if (this.module != config.previousModule) { - if ( config.previousModule ) { - QUnit.moduleDone( { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - QUnit.moduleStart( { - name: this.module - } ); - } - - config.current = this; - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment); - if (this.testEnvironmentArg) { - extend(this.testEnvironment, this.testEnvironmentArg); - } - - QUnit.testStart( { - name: this.testName - } ); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - try { - if ( !config.pollution ) { - saveGlobal(); - } - - this.testEnvironment.setup.call(this.testEnvironment); - } catch(e) { - QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message ); - } - }, - run: function() { - if ( this.async ) { - QUnit.stop(); - } - - if ( config.notrycatch ) { - this.callback.call(this.testEnvironment); - return; - } - try { - this.callback.call(this.testEnvironment); - } catch(e) { - fail("Test " + this.testName + " died, exception and test follows", e, this.callback); - QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - start(); - } - } - }, - teardown: function() { - try { - this.testEnvironment.teardown.call(this.testEnvironment); - checkPollution(); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message ); - } - }, - finish: function() { - if ( this.expected && this.expected != this.assertions.length ) { - QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); - } - - var good = 0, bad = 0, - tests = id("qunit-tests"); - - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - var ol = document.createElement("ol"); - - for ( var i = 0; i < this.assertions.length; i++ ) { - var assertion = this.assertions[i]; - - var li = document.createElement("li"); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if (bad) { - sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad); - } else { - sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName); - } - } - - if (bad == 0) { - ol.style.display = "none"; - } - - var b = document.createElement("strong"); - b.innerHTML = this.name + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - var a = document.createElement("a"); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - - addEvent(b, "click", function() { - var next = b.nextSibling.nextSibling, - display = next.style.display; - next.style.display = display === "none" ? "block" : "none"; - }); - - addEvent(b, "dblclick", function(e) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - } - }); - - var li = id(this.id); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( ol ); - - } else { - for ( var i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); - } - - QUnit.testDone( { - name: this.testName, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length - } ); - }, - - queue: function() { - var test = this; - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - // defer when previous test run passed, if storage is available - var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName); - if (bad) { - run(); - } else { - synchronize(run); - }; - } - -}; - -var QUnit = { - - // call on start of module test to prepend name to all tests - module: function(name, testEnvironment) { - config.currentModule = name; - config.currentModuleTestEnviroment = testEnvironment; - }, - - asyncTest: function(testName, expected, callback) { - if ( arguments.length === 2 ) { - callback = expected; - expected = 0; - } - - QUnit.test(testName, expected, callback, true); - }, - - test: function(testName, expected, callback, async) { - var name = '' + testName + '', testEnvironmentArg; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } - - if ( config.currentModule ) { - name = '' + config.currentModule + ": " + name; - } - - if ( !validTest(config.currentModule + ": " + testName) ) { - return; - } - - var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); - test.module = config.currentModule; - test.moduleTestEnvironment = config.currentModuleTestEnviroment; - test.queue(); - }, - - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ - expect: function(asserts) { - config.current.expected = asserts; - }, - - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { - a = !!a; - var details = { - result: a, - message: msg - }; - msg = escapeHtml(msg); - QUnit.log(details); - config.current.assertions.push({ - result: a, - message: msg - }); - }, - - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ - equal: function(actual, expected, message) { - QUnit.push(expected == actual, actual, expected, message); - }, - - notEqual: function(actual, expected, message) { - QUnit.push(expected != actual, actual, expected, message); - }, - - deepEqual: function(actual, expected, message) { - QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); - }, - - notDeepEqual: function(actual, expected, message) { - QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message); - }, - - strictEqual: function(actual, expected, message) { - QUnit.push(expected === actual, actual, expected, message); - }, - - notStrictEqual: function(actual, expected, message) { - QUnit.push(expected !== actual, actual, expected, message); - }, - - raises: function(block, expected, message) { - var actual, ok = false; - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - if (actual) { - // we don't want to validate thrown error - if (!expected) { - ok = true; - // expected is a regexp - } else if (QUnit.objectType(expected) === "regexp") { - ok = expected.test(actual); - // expected is a constructor - } else if (actual instanceof expected) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if (expected.call({}, actual) === true) { - ok = true; - } - } - - QUnit.ok(ok, message); - }, - - start: function() { - config.semaphore--; - if (config.semaphore > 0) { - // don't start until equal number of stop-calls - return; - } - if (config.semaphore < 0) { - // ignore if start is called more often then stop - config.semaphore = 0; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if (config.semaphore > 0) { - return; - } - if ( config.timeout ) { - clearTimeout(config.timeout); - } - - config.blocking = false; - process(); - }, 13); - } else { - config.blocking = false; - process(); - } - }, - - stop: function(timeout) { - config.semaphore++; - config.blocking = true; - - if ( timeout && defined.setTimeout ) { - clearTimeout(config.timeout); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - QUnit.start(); - }, timeout); - } - } -}; - -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; - -// Maintain internal state -var config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - urlConfig: ['noglobals', 'notrycatch'] -}; - -// Load paramaters -(function() { - var location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( var i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - config.filter = urlParams.filter; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); - -// Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS -if ( typeof exports === "undefined" || typeof require === "undefined" ) { - extend(window, QUnit); - window.QUnit = QUnit; -} else { - extend(exports, QUnit); - exports.QUnit = QUnit; -} - -// define these after exposing globals to keep them in these QUnit namespace only -extend(QUnit, { - config: config, - - // Initialize the configuration options - init: function() { - extend(config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date, - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 0 - }); - - var tests = id( "qunit-tests" ), - banner = id( "qunit-banner" ), - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = 'Running...
       '; - } - }, - - /** - * Resets the test setup. Useful for tests that modify the DOM. - * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. - */ - reset: function() { - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - var main = id( 'qunit-fixture' ); - if ( main ) { - main.innerHTML = config.fixture; - } - } - }, - - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent("MouseEvents"); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - elem.dispatchEvent( event ); - - } else if ( elem.fireEvent ) { - elem.fireEvent("on"+type); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) == type; - }, - - objectType: function( obj ) { - if (typeof obj === "undefined") { - return "undefined"; - - // consider: typeof null === object - } - if (obj === null) { - return "null"; - } - - var type = Object.prototype.toString.call( obj ) - .match(/^\[object\s(.*)\]$/)[1] || ''; - - switch (type) { - case 'Number': - if (isNaN(obj)) { - return "nan"; - } else { - return "number"; - } - case 'String': - case 'Boolean': - case 'Array': - case 'Date': - case 'RegExp': - case 'Function': - return type.toLowerCase(); - } - if (typeof obj === "object") { - return "object"; - } - return undefined; - }, - - push: function(result, actual, expected, message) { - var details = { - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeHtml(message) || (result ? "okay" : "failed"); - message = '' + message + ""; - expected = escapeHtml(QUnit.jsDump.parse(expected)); - actual = escapeHtml(QUnit.jsDump.parse(actual)); - var output = message + ''; - if (actual != expected) { - output += ''; - output += ''; - } - if (!result) { - var source = sourceFromStacktrace(); - if (source) { - details.source = source; - output += ''; - } - } - output += "
      Expected:
      ' + expected + '
      Result:
      ' + actual + '
      Diff:
      ' + QUnit.diff(expected, actual) +'
      Source:
      ' + escapeHtml(source) + '
      "; - - QUnit.log(details); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var querystring = "?", - key; - for ( key in params ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent, - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: function() {}, - // done: { failed, passed, total, runtime } - done: function() {}, - // log: { result, actual, expected, message } - log: function() {}, - // testStart: { name } - testStart: function() {}, - // testDone: { name, failed, passed, total } - testDone: function() {}, - // moduleStart: { name } - moduleStart: function() {}, - // moduleDone: { name, failed, passed, total } - moduleDone: function() {} -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - QUnit.begin({}); - - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var urlConfigHtml = '', len = config.urlConfig.length; - for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) { - config[val] = QUnit.urlParams[val]; - urlConfigHtml += ''; - } - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - var banner = id("qunit-header"); - if ( banner ) { - banner.innerHTML = ' ' + banner.innerHTML + ' ' + urlConfigHtml; - addEvent( banner, "change", function( event ) { - var params = {}; - params[ event.target.name ] = event.target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - addEvent( filter, "click", function() { - var ol = document.getElementById("qunit-tests"); - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace(/ hidepass /, " "); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem("qunit-filter-passed-tests", "true"); - } else { - sessionStorage.removeItem("qunit-filter-passed-tests"); - } - } - }); - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { - filter.checked = true; - var ol = document.getElementById("qunit-tests"); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - } - - var main = id('qunit-fixture'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if (config.autostart) { - QUnit.start(); - } -}; - -addEvent(window, "load", QUnit.load); - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - QUnit.moduleDone( { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - - var banner = id("qunit-banner"), - tests = id("qunit-tests"), - runtime = +new Date - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - 'Tests completed in ', - runtime, - ' milliseconds.
      ', - '', - passed, - ' tests of ', - config.stats.all, - ' passed, ', - config.stats.bad, - ' failed.' - ].join(''); - - if ( banner ) { - banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - (config.stats.bad ? "\u2716" : "\u2714"), - document.title.replace(/^[\u2714\u2716] /i, "") - ].join(" "); - } - - QUnit.done( { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - } ); -} - -function validTest( name ) { - var filter = config.filter, - run = false; - - if ( !filter ) { - return true; - } - - var not = filter.charAt( 0 ) === "!"; - if ( not ) { - filter = filter.slice( 1 ); - } - - if ( name.indexOf( filter ) !== -1 ) { - return !not; - } - - if ( not ) { - run = true; - } - - return run; -} - -// so far supports only Firefox, Chrome and Opera (buggy) -// could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace() { - try { - throw new Error(); - } catch ( e ) { - if (e.stacktrace) { - // Opera - return e.stacktrace.split("\n")[6]; - } else if (e.stack) { - // Firefox, Chrome - return e.stack.split("\n")[4]; - } else if (e.sourceURL) { - // Safari, PhantomJS - // TODO sourceURL points at the 'throw new Error' line above, useless - //return e.sourceURL + ":" + e.line; - } - } -} - -function escapeHtml(s) { - if (!s) { - return ""; - } - s = s + ""; - return s.replace(/[\&"<>\\]/g, function(s) { - switch(s) { - case "&": return "&"; - case "\\": return "\\\\"; - case '"': return '\"'; - case "<": return "<"; - case ">": return ">"; - default: return s; - } - }); -} - -function synchronize( callback ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process(); - } -} - -function process() { - var start = (new Date()).getTime(); - - while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { - config.queue.shift()(); - } else { - window.setTimeout( process, 13 ); - break; - } - } - if (!config.blocking && !config.queue.length) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - config.pollution.push( key ); - } - } -} - -function checkPollution( name ) { - var old = config.pollution; - saveGlobal(); - - var newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - var deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var result = a.slice(); - for ( var i = 0; i < result.length; i++ ) { - for ( var j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice(i, 1); - i--; - break; - } - } - } - return result; -} - -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - -function extend(a, b) { - for ( var prop in b ) { - if ( b[prop] === undefined ) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - - return a; -} - -function addEvent(elem, type, fn) { - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, fn ); - } else { - fn(); - } -} - -function id(name) { - return !!(typeof document !== "undefined" && document && document.getElementById) && - document.getElementById( name ); -} - -// Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv -// Author: Philippe Rathé -QUnit.equiv = function () { - - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = QUnit.objectType(o); - if (prop) { - if (QUnit.objectType(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string" : useStrictEquality, - "boolean" : useStrictEquality, - "number" : useStrictEquality, - "null" : useStrictEquality, - "undefined" : useStrictEquality, - - "nan" : function(b) { - return isNaN(b); - }, - - "date" : function(b, a) { - return QUnit.objectType(b) === "date" - && a.valueOf() === b.valueOf(); - }, - - "regexp" : function(b, a) { - return QUnit.objectType(b) === "regexp" - && a.source === b.source && // the regex itself - a.global === b.global && // and its modifers - // (gmi) ... - a.ignoreCase === b.ignoreCase - && a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function" : function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array" : function(b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if (!(QUnit.objectType(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for (j = 0; j < parents.length; j++) { - if (parents[j] === a[i]) { - loop = true;// dont rewalk array - } - } - if (!loop && !innerEquiv(a[i], b[i])) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object" : function(b, a) { - var i, j, loop; - var eq = true; // unless we can proove it - var aProperties = [], bProperties = []; // collection of - // strings - - // comparing constructors is more strict than using - // instanceof - if (a.constructor !== b.constructor) { - return false; - } - - // stack constructor before traversing properties - callers.push(a.constructor); - // track reference to avoid circular references - parents.push(a); - - for (i in a) { // be strict: don't ensures hasOwnProperty - // and go deep - loop = false; - for (j = 0; j < parents.length; j++) { - if (parents[j] === a[i]) - loop = true; // don't go down the same path - // twice - } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv(a[i], b[i])) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for (i in b) { - bProperties.push(i); // collect b's properties - } - - // Ensures identical properties name - return eq - && innerEquiv(aProperties.sort(), bProperties - .sort()); - } - }; - }(); - - innerEquiv = function() { // can take multiple arguments - var args = Array.prototype.slice.apply(arguments); - if (args.length < 2) { - return true; // end transition - } - - return (function(a, b) { - if (a === b) { - return true; // catch the most you can - } else if (a === null || b === null || typeof a === "undefined" - || typeof b === "undefined" - || QUnit.objectType(a) !== QUnit.objectType(b)) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - })(args[0], args[1]) - && arguments.callee.apply(this, args.splice(1, - args.length - 1)); - }; - - return innerEquiv; - -}(); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace(/"/g, '\\"') + '"'; - }; - function literal( o ) { - return o + ''; - }; - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) - arr = arr.join( ',' + s + inner ); - if ( !arr ) - return pre + post; - return [ pre, inner + arr, base + post ].join(s); - }; - function array( arr, stack ) { - var i = arr.length, ret = Array(i); - this.up(); - while ( i-- ) - ret[i] = this.parse( arr[i] , undefined , stack); - this.down(); - return join( '[', ret, ']' ); - }; - - var reName = /^function (\w+)/; - - var jsDump = { - parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance - stack = stack || [ ]; - var parser = this.parsers[ type || this.typeOf(obj) ]; - type = typeof parser; - var inStack = inArray(obj, stack); - if (inStack != -1) { - return 'recursion('+(inStack - stack.length)+')'; - } - //else - if (type == 'function') { - stack.push(obj); - var res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - // else - return (type == 'string') ? parser : this.parsers.error; - }, - typeOf:function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if (typeof obj === "undefined") { - type = "undefined"; - } else if (QUnit.is("RegExp", obj)) { - type = "regexp"; - } else if (QUnit.is("Date", obj)) { - type = "date"; - } else if (QUnit.is("Function", obj)) { - type = "function"; - } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") { - type = "window"; - } else if (obj.nodeType === 9) { - type = "document"; - } else if (obj.nodeType) { - type = "node"; - } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) { - type = "array"; - } else { - type = typeof obj; - } - return type; - }, - separator:function() { - return this.multiline ? this.HTML ? '
      ' : '\n' : this.HTML ? ' ' : ' '; - }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) - return ''; - var chr = this.indentChar; - if ( this.HTML ) - chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); - }, - up:function( a ) { - this._depth_ += a || 1; - }, - down:function( a ) { - this._depth_ -= a || 1; - }, - setParser:function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ - window: '[Window]', - document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen - unknown: '[Unknown]', - 'null':'null', - 'undefined':'undefined', - 'function':function( fn ) { - var ret = 'function', - name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) - ret += ' ' + name; - ret += '('; - - ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); - return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' ); - }, - array: array, - nodelist: array, - arguments: array, - object:function( map, stack ) { - var ret = [ ]; - QUnit.jsDump.up(); - for ( var key in map ) { - var val = map[key]; - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack)); - } - QUnit.jsDump.down(); - return join( '{', ret, '}' ); - }, - node:function( node ) { - var open = QUnit.jsDump.HTML ? '<' : '<', - close = QUnit.jsDump.HTML ? '>' : '>'; - - var tag = node.nodeName.toLowerCase(), - ret = open + tag; - - for ( var a in QUnit.jsDump.DOMAttrs ) { - var val = node[QUnit.jsDump.DOMAttrs[a]]; - if ( val ) - ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); - } - return ret + close + open + '/' + tag + close; - }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function - var l = fn.length; - if ( !l ) return ''; - - var args = Array(l); - while ( l-- ) - args[l] = String.fromCharCode(97+l);//97 is 'a' - return ' ' + args.join(', ') + ' '; - }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal - }, - DOMAttrs:{//attributes to dump from nodes, name=>realName - id:'id', - name:'name', - 'class':'className' - }, - HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) - indentChar:' ',//indentation unit - multiline:true //if true, items in a collection, are separated by a \n, else just a space. - }; - - return jsDump; -})(); - -// from Sizzle.js -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -}; - -//from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - function diff(o, n) { - var ns = {}; - var os = {}; - - for (var i = 0; i < n.length; i++) { - if (ns[n[i]] == null) - ns[n[i]] = { - rows: [], - o: null - }; - ns[n[i]].rows.push(i); - } - - for (var i = 0; i < o.length; i++) { - if (os[o[i]] == null) - os[o[i]] = { - rows: [], - n: null - }; - os[o[i]].rows.push(i); - } - - for (var i in ns) { - if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { - n[ns[i].rows[0]] = { - text: n[ns[i].rows[0]], - row: os[i].rows[0] - }; - o[os[i].rows[0]] = { - text: o[os[i].rows[0]], - row: ns[i].rows[0] - }; - } - } - - for (var i = 0; i < n.length - 1; i++) { - if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && - n[i + 1] == o[n[i].row + 1]) { - n[i + 1] = { - text: n[i + 1], - row: n[i].row + 1 - }; - o[n[i].row + 1] = { - text: o[n[i].row + 1], - row: i + 1 - }; - } - } - - for (var i = n.length - 1; i > 0; i--) { - if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && - n[i - 1] == o[n[i].row - 1]) { - n[i - 1] = { - text: n[i - 1], - row: n[i].row - 1 - }; - o[n[i].row - 1] = { - text: o[n[i].row - 1], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function(o, n) { - o = o.replace(/\s+$/, ''); - n = n.replace(/\s+$/, ''); - var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); - - var str = ""; - - var oSpace = o.match(/\s+/g); - if (oSpace == null) { - oSpace = [" "]; - } - else { - oSpace.push(" "); - } - var nSpace = n.match(/\s+/g); - if (nSpace == null) { - nSpace = [" "]; - } - else { - nSpace.push(" "); - } - - if (out.n.length == 0) { - for (var i = 0; i < out.o.length; i++) { - str += '' + out.o[i] + oSpace[i] + ""; - } - } - else { - if (out.n[0].text == null) { - for (n = 0; n < out.o.length && out.o[n].text == null; n++) { - str += '' + out.o[n] + oSpace[n] + ""; - } - } - - for (var i = 0; i < out.n.length; i++) { - if (out.n[i].text == null) { - str += '' + out.n[i] + nSpace[i] + ""; - } - else { - var pre = ""; - - for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) { - pre += '' + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -})(); - -})(this); diff --git a/tests/common/js/xml_js_filter.test.js b/tests/common/js/xml_js_filter.test.js deleted file mode 100644 index 3b38671ab..000000000 --- a/tests/common/js/xml_js_filter.test.js +++ /dev/null @@ -1,52 +0,0 @@ -jQuery(function($){ - module('Validator'); - - var - v = xe.getApp('validator')[0], - $form = $('#validator-test'), - form = $form[0], elems = form.elements; - - var Mute = xe.createPlugin('Mute', { - API_BEFORE_ALERT : function(){ return false } - }); - v.registerPlugin(new Mute()); - - test('Basics', function(){ - ok(v.run(form), 'Default return value is true'); - }); - - test('attr : required?', function(){ - form.reset(); - form.ruleset.value = 'ruleset'; - - v.cast('ADD_FILTER', ['ruleset', {'user_1':{required:true}}]); - ok(!v.run(form), 'The required field should have some value. - test1'); - - elems.user_1.value = 'myname'; - ok(v.run(form), 'The required field should have some value. - test2'); - }); - - test('attr : name pattern', function(){ - form.reset(); - form.ruleset.value = 'ruleset'; - - v.cast( - 'ADD_FILTER', - ['ruleset', - { - '^user_':{required:true} - } - ] - ); - - elems.user_1.value = 'value1'; - ok(!v.run(form), 'This test should be failed. (only one of three fields has value)'); - - elems.user_2.value = 'value2'; - ok(!v.run(form), 'not yet (2 of 3)'); - - elems.user_3.value = 'value3'; - ok(v.run(form), 'ok! you should pass at this time. (3 of 3)'); - }); - -}); diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml new file mode 100644 index 000000000..3b17a39dc --- /dev/null +++ b/tests/functional.suite.yml @@ -0,0 +1,9 @@ +# Codeception Test Suite Configuration + +# suite for functional (integration) tests. +# emulate web requests and make application process them. +# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it. + +class_name: FunctionalTester +modules: + enabled: [Filesystem, FunctionalHelper] diff --git a/tests/functional/FunctionalTester.php b/tests/functional/FunctionalTester.php new file mode 100644 index 000000000..ae32a1137 --- /dev/null +++ b/tests/functional/FunctionalTester.php @@ -0,0 +1,360 @@ +scenario->runStep(new \Codeception\Step\Condition('amInPath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opens a file and stores it's content. + * + * Usage: + * + * ``` php + * openFile('composer.json'); + * $I->seeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $filename + * @see \Codeception\Module\Filesystem::openFile() + */ + public function openFile($filename) { + return $this->scenario->runStep(new \Codeception\Step\Action('openFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes a file + * + * ``` php + * deleteFile('composer.lock'); + * ?> + * ``` + * + * @param $filename + * @see \Codeception\Module\Filesystem::deleteFile() + */ + public function deleteFile($filename) { + return $this->scenario->runStep(new \Codeception\Step\Action('deleteFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes directory with all subdirectories + * + * ``` php + * deleteDir('vendor'); + * ?> + * ``` + * + * @param $dirname + * @see \Codeception\Module\Filesystem::deleteDir() + */ + public function deleteDir($dirname) { + return $this->scenario->runStep(new \Codeception\Step\Action('deleteDir', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Copies directory with all contents + * + * ``` php + * copyDir('vendor','old_vendor'); + * ?> + * ``` + * + * @param $src + * @param $dst + * @see \Codeception\Module\Filesystem::copyDir() + */ + public function copyDir($src, $dst) { + return $this->scenario->runStep(new \Codeception\Step\Action('copyDir', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks If opened file has `text` in it. + * + * Usage: + * + * ``` php + * openFile('composer.json'); + * $I->seeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeInThisFile() + */ + public function canSeeInThisFile($text) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks If opened file has `text` in it. + * + * Usage: + * + * ``` php + * openFile('composer.json'); + * $I->seeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * @see \Codeception\Module\Filesystem::seeInThisFile() + */ + public function seeInThisFile($text) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks the strict matching of file contents. + * Unlike `seeInThisFile` will fail if file has something more than expected lines. + * Better to use with HEREDOC strings. + * Matching is done after removing "\r" chars from file content. + * + * ``` php + * openFile('process.pid'); + * $I->seeFileContentsEqual('3192'); + * ?> + * ``` + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeFileContentsEqual() + */ + public function canSeeFileContentsEqual($text) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks the strict matching of file contents. + * Unlike `seeInThisFile` will fail if file has something more than expected lines. + * Better to use with HEREDOC strings. + * Matching is done after removing "\r" chars from file content. + * + * ``` php + * openFile('process.pid'); + * $I->seeFileContentsEqual('3192'); + * ?> + * ``` + * + * @param $text + * @see \Codeception\Module\Filesystem::seeFileContentsEqual() + */ + public function seeFileContentsEqual($text) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks If opened file doesn't contain `text` in it + * + * ``` php + * openFile('composer.json'); + * $I->dontSeeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::dontSeeInThisFile() + */ + public function cantSeeInThisFile($text) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks If opened file doesn't contain `text` in it + * + * ``` php + * openFile('composer.json'); + * $I->dontSeeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * @see \Codeception\Module\Filesystem::dontSeeInThisFile() + */ + public function dontSeeInThisFile($text) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Deletes a file + * @see \Codeception\Module\Filesystem::deleteThisFile() + */ + public function deleteThisFile() { + return $this->scenario->runStep(new \Codeception\Step\Action('deleteThisFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file exists in path. + * Opens a file when it's exists + * + * ``` php + * seeFileFound('UserModel.php','app/models'); + * ?> + * ``` + * + * @param $filename + * @param string $path + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::seeFileFound() + */ + public function canSeeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file exists in path. + * Opens a file when it's exists + * + * ``` php + * seeFileFound('UserModel.php','app/models'); + * ?> + * ``` + * + * @param $filename + * @param string $path + * @see \Codeception\Module\Filesystem::seeFileFound() + */ + public function seeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file does not exists in path + * + * @param $filename + * @param string $path + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\Filesystem::dontSeeFileFound() + */ + public function cantSeeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeFileFound', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file does not exists in path + * + * @param $filename + * @param string $path + * @see \Codeception\Module\Filesystem::dontSeeFileFound() + */ + public function dontSeeFileFound($filename, $path = null) { + return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeFileFound', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Erases directory contents + * + * ``` php + * cleanDir('logs'); + * ?> + * ``` + * + * @param $dirname + * @see \Codeception\Module\Filesystem::cleanDir() + */ + public function cleanDir($dirname) { + return $this->scenario->runStep(new \Codeception\Step\Action('cleanDir', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Saves contents to file + * + * @param $filename + * @param $contents + * @see \Codeception\Module\Filesystem::writeToFile() + */ + public function writeToFile($filename, $contents) { + return $this->scenario->runStep(new \Codeception\Step\Action('writeToFile', func_get_args())); + } +} diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php new file mode 100644 index 000000000..8a8855580 --- /dev/null +++ b/tests/functional/_bootstrap.php @@ -0,0 +1,2 @@ + */ -error_reporting(0); - -class adminAdminControllerTest extends PHPUnit_Framework_TestCase -{ - private $oAdminAdminController; - - protected function setUp() - { - define('__ZBXE__', TRUE); - define('__XE__', TRUE); - require_once '../../../config/config.inc.php'; - require_once _XE_PATH_.'classes/file/FileHandler.class.php'; - require_once _XE_PATH_.'classes/context/Context.class.php'; - require_once _XE_PATH_.'modules/admin/admin.class.php'; - require_once _XE_PATH_.'modules/admin/admin.admin.controller.php'; - - $logged_info = new stdclass; - $logged_info->member_srl = 4; - $logged_info->user_id = 'admin'; - $logged_info->email_address = 'admin@admin.com'; - $logged_info->password = 'c4ca4238a0b923820dcc509a6f75849b'; - $logged_info->email_id = 'admin'; - $logged_info->email_host = 'admin.com'; - $logged_info->user_name = 'admin'; - $logged_info->nick_name = 'admin'; - $logged_info->find_account_question = 1; - $logged_info->find_account_answer = 'admin@naver.com'; - $logged_info->allow_mailing = 'Y'; - $logged_info->allow_message = 'Y'; - $logged_info->denied = 'N'; - $logged_info->regdate = '20110520142031'; - $logged_info->last_login = '20120905135102'; - $logged_info->change_password_date = '20110520142031'; - $logged_info->is_admin = 'Y'; - $logged_info->list_order = -1; - - $oContext = &Context::getInstance(); - //$oContext->init(); - $oContext->set('is_logged', true); - $oContext->set('logged_info', $logged_info); - $oContext->set('is_admin', 'Y'); - - $this->oAdminAdminController = getAdminController('admin'); - } - - public function testInsertLayout() - { - $args->layout_srl = 62; - $args->module = 'board'; - $args->module_skin = 'xe_board'; - $args->site_srl = 0; - - $args->skin_vars->colorset = 'white'; - $args->skin_vars->colorset = 'red'; - $args->skin_vars->default_style = 'gallery'; - $args->skin_vars->display_login_info = 'N'; - $args->skin_vars->display_setup_button = 'N'; - $args->skin_vars->header_title_format = 'h1'; - $args->skin_vars->document_title_format = 'h1'; - $args->skin_vars->display_number = 'Y'; - $args->skin_vars->display_author = 'Y'; - $args->skin_vars->display_regdate = 'Y'; - $args->skin_vars->display_readed_count = 'Y'; - $args->skin_vars->display_voted_count = 'Y'; - $args->skin_vars->display_blamed_count = 'Y'; - $args->skin_vars->display_ip_address = 'Y'; - $args->skin_vars->display_last_update = 'Y'; - $args->skin_vars->display_sign = 'Y'; - $args->skin_vars->duration_new = '24'; - $args->skin_vars->thumbnail_type = 'crop'; - $args->skin_vars->thumbnail_width = '100'; - $args->skin_vars->thumbnail_height = '100'; - - $oContext = &Context::getInstance(); - //$oContext->init(); - $oContext->set('layout_srl', $args->layout_srl); - $oContext->set('module', $args->module); - $oContext->set('module_skin', $args->module_skin); - $oContext->set('skin_vars', $args->skin_vars); - $oContext->set('site_srl', $args->site_srl); - - $this->oAdminAdminController->updateDefaultDesignInfo($args); - - $file = _XE_PATH_.'files/site_design/design_0.php'; - - $this->assertFileExists($file); - - @include($file); - - $this->assertEquals($designInfo->layout_srl, $args->layout_srl); - $this->assertEquals($designInfo->module->{$args->module}->skin, $args->module_skin); - } -} -?> diff --git a/tests/modules/document/document.Test.php b/tests/modules/document/document.Test.php deleted file mode 100644 index 2c82dea93..000000000 --- a/tests/modules/document/document.Test.php +++ /dev/null @@ -1,124 +0,0 @@ - */ -error_reporting(0); - -class documentModelTest extends PHPUnit_Framework_TestCase -{ - public static $oDB; - private $oDocumentController = null; - private $oDocumentModel = null; - - protected function setUp() - { - define('__ZBXE__', TRUE); - require_once '../../../config/config.inc.php'; - require_once _XE_PATH_.'files/config/db.config.php'; - require_once _XE_PATH_.'classes/context/Context.class.php'; - require_once _XE_PATH_.'classes/db/DB.class.php'; - require_once _XE_PATH_.'classes/db/DBMysql.class.php'; - require_once _XE_PATH_.'modules/document/document.class.php'; - require_once _XE_PATH_.'modules/document/document.controller.php'; - require_once _XE_PATH_.'modules/document/document.model.php'; - - $db_info->master_db['db_database'] = $db_info->master_db['db_database'].'_test'; - if(is_array($db_info->slave_db)) - { - foreach($db_info->slave_db AS $key=>$slave_db) - { - $db_info->slave_db[$key]['db_database'] = $slave_db['db_database'].'_test'; - } - } - - $logged_info = new stdclass; - $logged_info->member_srl = 1; - $logged_info->user_id = 'neosky'; - $logged_info->email_address = 'neosky@naver.com'; - $logged_info->password = '4297f44b13955235245b2497399d7a93'; - $logged_info->email_id = 'neosky'; - $logged_info->email_host = 'naver.com'; - $logged_info->user_name = 'neosky'; - $logged_info->nick_name = 'neosky'; - $logged_info->find_account_question = 1; - $logged_info->find_account_answer = 'ovclas@naver.com'; - $logged_info->allow_mailing = 'Y'; - $logged_info->allow_message = 'Y'; - $logged_info->denied = 'N'; - $logged_info->regdate = '20110520142031'; - $logged_info->last_login = '20120905135102'; - $logged_info->change_password_date = '20110520142031'; - $logged_info->is_admin = 'N'; - $logged_info->list_order = -1; - - $oContext = &Context::getInstance(); - //$oContext->init(); - $oContext->setDBInfo($db_info); - $oContext->set('is_logged', true); - $oContext->set('logged_info', $logged_info); - - self::$oDB = new DBMysql; - - $this->oDocumentController = getController('document'); - $this->oDocumentModel = getModel('document'); - - } - - public function testInsertDocument() - { - $inputObj = new stdclass; - $inputObj->_filter = 'insert'; - $inputObj->error_return_url = '/1.5.0_admin/index.php?mid=freeboard&act=dispBoardWrite'; - $inputObj->act = 'procBoardInsertDocument'; - $inputObj->mid = 'freeboard'; - $inputObj->content = '

      content

      '; - $inputObj->category_srl = 237465; - $inputObj->title = 'title'; - $inputObj->extra_vars2 = 'extra_vars'; - $inputObj->_saved_doc_message = "자동 저장된 글이 있습니다. 복구하시겠습니까?\n글을 다 쓰신 후 저장하면 자동 저장 본은 사라집니다."; - $inputObj->comment_status = 'ALLOW'; - $inputObj->allow_trackback = 'Y'; - $inputObj->status = 'PUBLIC'; - $inputObj->module = 'board'; - $inputObj->module_srl = 57; - $inputObj->is_notice = 'N'; - $inputObj->commentStatus = 'ALLOW'; - - // document insert - $output = $this->oDocumentController->insertDocument($inputObj); - $insertedDocumentSrl = $output->get('document_srl'); - - // get Document - $oDocument = $this->oDocumentModel->getDocument($insertedDocumentSrl); - - $this->assertEquals($inputObj->title, $oDocument->get('title')); - $this->assertEquals($inputObj->content, $oDocument->get('content')); - $this->assertEquals($inputObj->is_notice, $oDocument->get('is_notice')); - $this->assertEquals($inputObj->status, $oDocument->get('status')); - $this->assertEquals($inputObj->comment_status, $oDocument->get('comment_status')); - $this->assertEquals($insertedDocumentSrl, $oDocument->get('document_srl')); - - // update Document - $inputObj->title = 'title2'; - $output = $this->oDocumentController->updateDocument($oDocument, $inputObj); - unset($GLOBALS['XE_DOCUMENT_LIST'][$insertedDocumentSrl]); - $oUpdatedDocument = $this->oDocumentModel->getDocument($insertedDocumentSrl); - - $this->assertEquals($inputObj->title, $oUpdatedDocument->get('title')); - $this->assertNotEquals($oDocument->get('title'), $oUpdatedDocument->get('title')); - - //$output = $oDocumentController->updateVotedCount($insertedDocumentSrl); - //debugPrint($output); - - // delete document - $output = $this->oDocumentController->deleteDocument($insertedDocumentSrl); - $this->assertEquals('success', $output->message); - - unset($oDocument, $GLOBALS['XE_DOCUMENT_LIST'][$insertedDocumentSrl]); - $oDocument = $this->oDocumentModel->getDocument($insertedDocumentSrl); - $this->assertEmpty($oDocument->document_srl); - } - - protected function tearDown() - { - } -} -?> diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index 9265eb265..000000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - . - ./classes/context/Context.mock.php - ./classes/db/ - ./classes/frontendfile/FrontEndFileHandlerTest.php - - - - - - - diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml new file mode 100644 index 000000000..4ffbf160e --- /dev/null +++ b/tests/unit.suite.yml @@ -0,0 +1,6 @@ +# Codeception Test Suite Configuration + +# suite for unit (internal) tests. +class_name: UnitTester +modules: + enabled: [Asserts, UnitHelper] diff --git a/tests/FuncIncTest.class.php b/tests/unit/FuncIncTest.class.php similarity index 90% rename from tests/FuncIncTest.class.php rename to tests/unit/FuncIncTest.class.php index ff436a91a..1aa57c6aa 100644 --- a/tests/FuncIncTest.class.php +++ b/tests/unit/FuncIncTest.class.php @@ -1,11 +1,7 @@ */ - -define('__XE__', 1); -define('_XE_PATH_', realpath(dirname(__FILE__).'/../')); require _XE_PATH_.'/config/func.inc.php'; -class FuncIncTest extends PHPUnit_Framework_TestCase +class FuncIncTest extends \Codeception\TestCase\Test { static public function xssProvider() { diff --git a/tests/unit/UnitTester.php b/tests/unit/UnitTester.php new file mode 100644 index 000000000..1cec72fc3 --- /dev/null +++ b/tests/unit/UnitTester.php @@ -0,0 +1,300 @@ +scenario->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not equal + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEquals() + */ + public function assertNotEquals($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are same + * + * @param $expected + * @param $actual + * @param string $message + * + * @return mixed + * @see \Codeception\Module\Asserts::assertSame() + */ + public function assertSame($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not same + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotSame() + */ + public function assertNotSame($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that expected is greater than actual + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThan() + */ + public function assertGreaterThan($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThen() + */ + public function assertGreaterThen($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that expected is greater or equal than actual + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() + */ + public function assertGreaterThanOrEqual($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual() + */ + public function assertGreaterThenOrEqual($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that expected is less than actual + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThan() + */ + public function assertLessThan($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that expected is less or equal than actual + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThanOrEqual() + */ + public function assertLessThanOrEqual($expected, $actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack contains needle + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertContains() + */ + public function assertContains($needle, $haystack, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack doesn't contain needle. + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertNotContains() + */ + public function assertNotContains($needle, $haystack, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertEmpty() + */ + public function assertEmpty($actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEmpty() + */ + public function assertNotEmpty($actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNull() + */ + public function assertNull($actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotNull() + */ + public function assertNotNull($actual, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is positive. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertTrue() + */ + public function assertTrue($condition, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is negative. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertFalse() + */ + public function assertFalse($condition, $message = null) { + return $this->scenario->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails the test with message. + * + * @param $message + * @see \Codeception\Module\Asserts::fail() + */ + public function fail($message) { + return $this->scenario->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } +} diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php new file mode 100644 index 000000000..31b359e8a --- /dev/null +++ b/tests/unit/_bootstrap.php @@ -0,0 +1,30 @@ +assertInstanceOf('Context', Context::getInstance()); + $this->assertSame(Context::getInstance(), Context::getInstance()); + } + + public function testSetGetVars() + { + $this->assertEquals(Context::get('var1'), null); + context::set('var1', 'val1'); + $this->assertEquals(Context::get('var1'), 'val1'); + + Context::set('var2', 'val2'); + $this->assertSame(Context::get('var2'), 'val2'); + + Context::set('var3', 'val3'); + $data = new stdClass(); + $data->var1 = 'val1'; + $data->var2 = 'val2'; + $this->assertEquals(Context::gets('var1','var2'), $data); + $data->var3 = 'val3'; + $this->assertEquals(Context::getAll(), $data); + } + + public function testAddGetBodyClass() + { + $this->assertEquals(Context::getBodyClass(), ''); + Context::addBodyClass('red'); + $this->assertEquals(Context::getBodyClass(), ' class="red"'); + Context::addBodyClass('green'); + $this->assertEquals(Context::getBodyClass(), ' class="red green"'); + Context::addBodyClass('blue'); + $this->assertEquals(Context::getBodyClass(), ' class="red green blue"'); + + // remove duplicated class + Context::addBodyClass('red'); + $this->assertEquals(Context::getBodyClass(), ' class="red green blue"'); + } + + public function testRequsetResponseMethod() + { + $this->assertEquals(Context::getRequestMethod(), 'GET'); + + $_SERVER['REQUEST_METHOD'] = 'POST'; + Context::setRequestMethod(); + $this->assertEquals(Context::getRequestMethod(), 'POST'); + + $GLOBALS['HTTP_RAW_POST_DATA'] = 'abcde'; + Context::setRequestMethod(); + $this->assertEquals(Context::getRequestMethod(), 'XMLRPC'); + + $_SERVER['CONTENT_TYPE'] = 'application/json'; + Context::setRequestMethod(); + $this->assertEquals(Context::getRequestMethod(), 'JSON'); + + Context::setRequestMethod('POST'); + $this->assertEquals(Context::getRequestMethod(), 'POST'); + + $this->assertEquals(Context::getResponseMethod(), 'HTML'); + Context::setRequestMethod('JSON'); + $this->assertEquals(Context::getResponseMethod(), 'JSON'); + + Context::setResponseMethod('WRONG_TYPE'); + $this->assertEquals(Context::getResponseMethod(), 'HTML'); + Context::setResponseMethod('XMLRPC'); + $this->assertEquals(Context::getResponseMethod(), 'XMLRPC'); + Context::setResponseMethod('HTML'); + $this->assertEquals(Context::getResponseMethod(), 'HTML'); + } +} diff --git a/tests/unit/classes/file/FileHandlerTest.php b/tests/unit/classes/file/FileHandlerTest.php new file mode 100644 index 000000000..38e1084d1 --- /dev/null +++ b/tests/unit/classes/file/FileHandlerTest.php @@ -0,0 +1,44 @@ +assertEquals(FileHandler::filesize(0), '0Byte'); + $this->assertEquals(FileHandler::filesize(1), '1Byte'); + $this->assertEquals(FileHandler::filesize(386), '386Bytes'); + $this->assertEquals(FileHandler::filesize(1023), '1023Bytes'); + $this->assertEquals(FileHandler::filesize(1024), '1.0KB'); + $this->assertEquals(FileHandler::filesize(2480), '2.4KB'); + $this->assertEquals(FileHandler::filesize(1024*1024-1), '1024.0KB'); + $this->assertEquals(FileHandler::filesize(1024*1024), '1.00MB'); + $this->assertEquals(FileHandler::filesize(3*1024*1024+210*1024), '3.21MB'); + + // return bytes + $this->assertEquals(FileHandler::returnBytes('0B'), 0); + $this->assertEquals(FileHandler::returnBytes('1024B'), 1024); + $this->assertEquals(FileHandler::returnBytes('1K'), 1024); + $this->assertEquals(FileHandler::returnBytes('102.48K'), round(1024*102.48)); + $this->assertEquals(FileHandler::returnBytes('1M'), 1024*1024); + $this->assertEquals(FileHandler::returnBytes('1.12M'), round(1024*1024*1.12)); + $this->assertEquals(FileHandler::returnBytes('1023.99M'), round(1024*1024*1023.99)); + $this->assertEquals(FileHandler::returnBytes('1G'), 1024*1024*1024); + $this->assertEquals(FileHandler::returnBytes('12.02G'), round(1024*1024*1024*12.02)); + } +} diff --git a/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php b/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php new file mode 100644 index 000000000..f0a5a0330 --- /dev/null +++ b/tests/unit/classes/frontendfile/FrontEndFileHandlerTest.php @@ -0,0 +1,158 @@ +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')); + + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.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')); + + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.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')); + + $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); + $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)); + + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.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)); + + $expected[] = array('file' => '/xe/common/js/jquery.js' . $this->_filemtime('common/js/jquery.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')); + + $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'); + $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", function() { + $handler = new FrontEndFileHandler(); + $handler->loadFile(array('//external.host/css/style.css')); + + $expected[] = array('file' => '//external.host/css/style.css', 'media'=>'all', 'targetie' => null); + $this->assertEquals($handler->getCssFileList(), $expected); + }); + + } +} diff --git a/tests/unit/classes/security/SecurityTest.php b/tests/unit/classes/security/SecurityTest.php new file mode 100644 index 000000000..9472b6a31 --- /dev/null +++ b/tests/unit/classes/security/SecurityTest.php @@ -0,0 +1,121 @@ +Hello, world'); + Context::set('content2', 'Wow, >_< !'); + + // object + $args = new stdClass; + $args->prop1 = 'Normal string'; + $args->prop2 = 'He said, "Very nice!"'; + $args->prop3 = 'Strong Baby'; + Context::set('object1', $args); + + // array + $arr = array(); + $arr[] = 'First'; + $arr[] = 'Second'; + $arr[] = 'Third'; + Context::set('array1', $arr); + + // associative array + $aarr = array(); + $aarr['elem1'] = 'One 1'; + $aarr['elem2'] = 'Two 2'; + $aarr['elem3'] = 'Three 3'; + Context::set('array2', $aarr); + } + + public function testEncodeHTML_DefaultContext() + { + $security = new Security(); + + // normal string - one + $this->setUp(); + $this->assertEquals('Hello, world', Context::get('content1')); + $security->encodeHTML('content1'); + $this->assertEquals('<strong>Hello, world</strong>', Context::get('content1')); + + // normal string - two + $this->setUp(); + $this->assertEquals('Hello, world', Context::get('content1')); + $this->assertEquals('Wow, >_< !', Context::get('content2')); + $security->encodeHTML('content1','content2'); + $this->assertEquals('<strong>Hello, world</strong>', Context::get('content1')); + $this->assertEquals('Wow, >_< !', Context::get('content2')); + + // array + $this->assertEquals(Context::get('array1'), array('First','Second','Third')); + $security->encodeHTML('array1'); // should ignore this + $this->assertEquals(Context::get('array1'), array('First','Second','Third')); + $security->encodeHTML('array1.0'); // affect only first element + $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','Second','Third')); + $security->encodeHTML('array1.2'); // affects only third element + $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','Second','<b>T</b>hird')); + $this->setUp(); // reset; + $this->assertEquals(Context::get('array1'), array('First','Second','Third')); + $security->encodeHTML('array1.'); // affects all items + $this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird')); + + // associated array + $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); + $security->encodeHTML('array2'); // should ignore this + $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); + $security->encodeHTML('array2.0'); // should ignore this + $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); + $security->encodeHTML('array2.elem2'); // affects only 'elem2' + $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two <del>2</del>','elem3'=>'Three 3')); + $this->setUp(); // reset; + $this->assertEquals(Context::get('array2'), array('elem1'=>'One 1','elem2'=>'Two 2','elem3'=>'Three 3')); + $security->encodeHTML('array2.'); // affects all items + $this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>')); + + // object + $obj = new stdClass; + $obj->prop1 = 'Normal string'; + $obj->prop2 = 'He said, "Very nice!"'; + $obj->prop3 = 'Strong Baby'; + $this->assertEquals(Context::get('object1'), $obj); + $security->encodeHTML('object1'); // should ignore this + $this->assertEquals(Context::get('object1'), $obj); + $security->encodeHTML('object1.0'); // should ignore this + $this->assertEquals(Context::get('object1'), $obj); + $security->encodeHTML('object1.prop1'); // affects only 'prop1' property - no changes + $this->assertEquals(Context::get('object1'), $obj); + $security->encodeHTML('object1.prop3'); // affects only 'prop3' property + $obj->prop3 = '<strong>Strong</strong> Baby'; + $this->assertEquals(Context::get('object1'), $obj); + $this->setUp(); // reset + $obj->prop3 = 'Strong Baby'; + $this->assertEquals(Context::get('object1'), $obj); + $security->encodeHTML('object1.'); // affects all properties + $obj->prop2 = 'He said, "Very nice!"'; + $obj->prop3 = '<strong>Strong</strong> Baby'; + $this->assertEquals(Context::get('object1'), $obj); + } + + public function testEncodeHTML_CustomContext() + { + $array = array('Hello', 'World', 'Bold is not bald'); + + // array with no nested objects or arrays + $security = new Security($array); + $returned = $security->encodeHTML('.'); + $this->assertEquals($returned, array('Hello', 'World', '<b>Bold</b> is not bald')); + + // associative array + $array = array('first'=>'Hello', 'second'=>'World', '3rd'=>'Bold is not bald'); + $security = new Security($array); + $returned = $security->encodeHTML('first','3rd'); + $this->assertEquals($returned, array('first'=>'Hello', 'second'=>'World', '3rd'=>'<b>Bold</b> is not bald')); + } +} diff --git a/tests/unit/classes/template/TemplateHandlerTest.php b/tests/unit/classes/template/TemplateHandlerTest.php new file mode 100644 index 000000000..edd2e57ab --- /dev/null +++ b/tests/unit/classes/template/TemplateHandlerTest.php @@ -0,0 +1,282 @@ + 10">Link', + '?>cond > 10){ ?> class="active">Link' + ), + // cond + array( + 'Link1say, hello', + '?>Link1cond){ ?>say, hello' + ), + // cond + array( + 'Link1Link2', + '?>Link1v==$__Context->k){ ?>Link2' + ), + // for loop + array( + '', + '?>
        i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
      • Link
      ' + ), + // foreach loop + array( + '', + '?>
        arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
      • Link
          arr2&&count($__Context->arr2))foreach($__Context->arr2 as $__Context->key2=>$__Context->val2){ ?>
      ' + ), + // while loop + array( + '', + '?>
        item=get_loop_item()){ ?>
      • Link
      ' + ), + // ~ + array( + 'LinkHello, world ', + '?>Linkcond){ ?>Hello, world ' + ), + // ~ + array( + 'LinkHello, {$world}', + '?>Linkcond){ ?>Hello, world ?>' + ), + // ~ ~ + array( + 'LinkHello, worldWow', + '?>Linkcond){ ?>Hello, worldWow' + ), + // ~ ~ ~ + array( + 'LinkHello, worldHaHaWow', + '?>Linkcond){ ?>Hello, worldcond2){ ?>HaHaWow' + ), + // ~ + array( + '
    1. Repeat this
    2. ', + PHP_EOL.'for($__Context->i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
    3. Repeat this
    4. ' + ), + // ~ + array( + '
    5. item{$key} : {$val}
    6. ', + PHP_EOL . 'if($__Context->arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
    7. itemkey ?> : val ?>
    8. ' + ), + // ~ + array( + '{$v->text}', + PHP_EOL.'while($__Context->item=$__Context->list->getItem()){ ?>v->text ?>' + ), + // ~ ~ ~ ~ + array( + ' A BC', + '?>var){;'.PHP_EOL.'case "A": ?> ABC' + ), + // invalid block statement + array( + '', + '?>' + ), + // {@ ...PHP_CODE...} + array( + '{@$list_page = $page_no}', + '?>list_page = $__Context->page_no ?>' + ), + // %load_js_plugin + array( + '', + '?>' + ), + // #include + array( + '
      This is another dummy
      ', + '?>compile(\'tests/unit/classes/template\',\'sample.html\') ?>
      This is another dummy
      ' + ), + // + array( + '
      This is another dummy
      ', + '?>compile(\'tests/unit/classes\',\'sample.html\') ?>
      This is another dummy
      ' + ), + // + array( + '', + '?>' + ), + // + array( + '', + '?>' + ), + // + array( + '', + '?>' + ), + // + array( + '', + '?>compile(); ?>' + ), + // + array( + '', + '?>' + ), + // + array( + '', + '?>' + ), + // comment + array( + '', + '?>' + ), + // self-closing tag + array( + '', + PHP_EOL . 'if($__Context->foo){ ?>' + ), + // relative path1 + array( + '', + '?>' + ), + // relative path2 + array( + '', + '?>' + ), + // error case + array( + 'logo', + PHP_EOL . 'if($__Context->layout_info->logo_image){ ?>logo' + ), + // error case - ignore stylesheets + array( + '', + '?>' + ), + // error case - ignore json + array( + '', + '?>' + ), + // error case - inline javascript + array( + '
      ', + '?>
      ' + ), + // issue 103 + array( + '', + '?>' + ), + // issue 135 + array( + '

      {$key}

      Loop block {$val}
      ', + PHP_EOL . 'if($__Context->_m_list_all&&count($__Context->_m_list_all))foreach($__Context->_m_list_all as $__Context->key=>$__Context->val){ ?>

      key ?>

      Loop block val ?>
      ' + ), + // issue 136 + array( + '
      bar', + PHP_EOL . 'if($__Context->var==\'foo\'){ ?>
      bar' + ), + // issue 188 + array( + '
      Hello, world!
      ', + PHP_EOL . 'if($__Context->ii < $__Context->nn){;'.PHP_EOL.'if($__Context->dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
      Hello, world!
      ' + ), + // issue 190 + array( + '
      Hello, world!
      ', + PHP_EOL . 'if(!($__Context->i >= $__Context->n)){;'.PHP_EOL.'if($__Context->dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
      Hello, world!
      ' + ), + // issue 183 + array( + ''."\n".'
      {$vvv}
      CD
      ', + '?>vvvls&&count($__Context->vvvls))foreach($__Context->vvvls as $__Context->vvv){ ?>'."\n".'
      vvv ?>
      CD
      ' + ), + // issue 512 - ignores + array( + '
      {$lang->sl_show_topimgtext}
      ', + '?>
      lang->sl_show_topimgtext ?>
      ' + ), + // issue 584 + array( + 'mobile', + PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?>mobile' + ), + // issue 831 + array( + "
    9. class=\"on\">", + "?>
    10. act, array(\n'dispNmsAdminGroupList',\n'dispNmsAdminInsertGroup',\n'dispNmsAdminGroupInfo',\n'dispNmsAdminDeleteGroup'))){ ?>class=\"on\">" + ), + // issue 746 + array( + '', + '?>' + ), + // issue 696 + array( + '{@ eval(\'$val = $document_srl;\')}', + PHP_EOL . 'eval(\'$__Context->val = $__Context->document_srl;\') ?>' + ), + ); + } + + /** + * @dataProvider provider + */ + public function testParse($tpl, $expected) + { + $tmpl = new TemplateHandlerWrapper; + $tmpl->init(dirname(__FILE__), 'no_file.html'); + $result = $tmpl->parse($tpl); + + $this->assertEquals($result, $this->prefix.$expected); + } + + public function testParse2() + { + $tmpl = new TemplateHandlerWrapper; + $tmpl->init(dirname(__FILE__), 'no_file.html'); + $result = $tmpl->parse($tpl); + + $this->assertEquals($result, ''); + } + + public function testCompileDirect() + { + $tmpl = TemplateHandler::getInstance(); + $result = $tmpl->compileDirect(dirname(__FILE__), 'sample.html'); + $result = trim($result); + + $this->assertEquals($result, $this->prefix.PHP_EOL.'if($__Context->has_blog){ ?>Taggon\'s blog'.PHP_EOL.''); + } +} + + +class TemplateHandlerWrapper extends \TemplateHandler { + private $inst; + + function __construct() { + $this->inst = parent::getInstance(); + } + + public function init($tpl_path, $tpl_filename, $tpl_file = '') { + call_user_method('init', $this->inst, $tpl_path, $tpl_filename, $tpl_file); + } + + public function parse($buff = null) { + return call_user_method('parse', $this->inst, $buff); + } +} diff --git a/tests/classes/template/css/style.css b/tests/unit/classes/template/css/style.css similarity index 100% rename from tests/classes/template/css/style.css rename to tests/unit/classes/template/css/style.css diff --git a/tests/classes/template/sample.html b/tests/unit/classes/template/sample.html similarity index 61% rename from tests/classes/template/sample.html rename to tests/unit/classes/template/sample.html index 949b441ba..25c9ed90b 100644 --- a/tests/classes/template/sample.html +++ b/tests/unit/classes/template/sample.html @@ -1 +1,2 @@ Taggon's blog + diff --git a/tests/unit/classes/validator/ValidatorTest.php b/tests/unit/classes/validator/ValidatorTest.php new file mode 100644 index 000000000..c3045f814 --- /dev/null +++ b/tests/unit/classes/validator/ValidatorTest.php @@ -0,0 +1,208 @@ +filter = new stdClass; + $lang->filter->isnull = 'isnull'; + $lang->filter->outofrange = 'outofrange'; + $lang->filter->equalto = 'equalto'; + } + + public function testRequired() + { + $vd = new Validator(); + $vd->addFilter('userid', array('required'=>'true')); + + // given data + $this->assertFalse( $vd->validate(array('no-userid'=>'hello')) ); + $this->assertTrue( $vd->validate(array('userid'=>'myuserid')) ); + $this->assertFalse( $vd->validate(array('userid'=>'')) ); + + // context data + $this->assertFalse( $vd->validate() ); + Context::set('userid', '', true); + $this->assertFalse( $vd->validate() ); + Context::set('userid', 'myuserid', true); + $this->assertTrue( $vd->validate() ); + $vd->removeFilter('userid'); + $this->assertTrue( $vd->validate() ); + } + + public function testNamePattern() + { + $vd = new Validator(); + $vd->addFilter('^user_', array('length'=>'5:')); + + Context::set('user_123', 'abcd', true); + Context::set('user_456', '123', true); + $this->assertFalse( $vd->validate() ); + + Context::set('user_123', 'abcdefg', true); + $this->assertFalse( $vd->validate() ); + + Context::set('user_456', '123456', true); + $this->assertTrue( $vd->validate() ); + } + + public function testEqualTo() + { + $vd = new Validator(); + $vd->addFilter('pass1', array('equalto'=>'pass2')); + + Context::set('pass1', 'MyPassword', true); + $this->assertFalse( $vd->validate() ); + Context::set('pass2', 'WorngPassword', true); + $this->assertFalse( $vd->validate() ); + Context::set('pass2', 'MyPassword', true); + $this->assertTrue( $vd->validate() ); + } + + public function testArrayTrim() + { + $vd = new Validator(); + + $arr = array('red'=>'apple', 'yellow'=>'banana ', 'green'=>' papaya '); + $this->assertEquals($vd->arrayTrim($arr), array('red'=>'apple', 'yellow'=>'banana', 'green'=>'papaya')); + $this->assertEquals($vd->arrayTrim(' string '), 'string'); + } + + public function testLength() + { + $vd = new Validator(); + + $vd->addFilter('field1', array('length'=>'3:')); + $this->assertFalse( $vd->validate(array('field1'=>'ab')) ); + $this->assertTrue( $vd->validate(array('field1'=>'abc')) ); + $this->assertTrue( $vd->validate(array('field1'=>'abcd')) ); + } + + public function testCustomRule() + { + // regex + $vd = new Validator(); + $customRules['regex_rule']['type'] = 'regex'; + $customRules['regex_rule']['test'] = '/^[a-z]+$/'; + $vd->addRule($customRules); + $vd->addFilter('regex_field', array('rule' => 'regex_rule')); + + $this->assertTrue($vd->validate(array('regex_field' => 'abc'))); + $this->assertFalse($vd->validate(array('regex_field' => 'ABC'))); + + // enum + $vd = new Validator(); + $customRules['enum_rule']['type'] = 'enum'; + $customRules['enum_rule']['test'] = 'a,b,c'; + $vd->addRule($customRules); + $vd->addFilter('enum_field', array('rule' => 'enum_rule')); + + $this->assertTrue($vd->validate(array('enum_field' => 'a'))); + $this->assertFalse($vd->validate(array('enum_field' => 'd'))); + + // enum with custom delimiter + $vd = new Validator(); + $customRules['enum_rule2']['type'] = 'enum'; + $customRules['enum_rule2']['test'] = 'a@b@c'; + $customRules['enum_rule2']['delim'] = '@'; + $vd->addRule($customRules); + $vd->addFilter('enum_field2', array('rule' => 'enum_rule2')); + + $this->assertTrue($vd->validate(array('enum_field2' => 'a'))); + $this->assertFalse($vd->validate(array('enum_field2' => 'd'))); + + // expr + $vd = new Validator(); + $customRules['expr_rule']['type'] = 'expr'; + $customRules['expr_rule']['test'] = '$$ < 10'; + $vd->addRule($customRules); + $vd->addFilter('expr_field', array('rule' => 'expr_rule')); + + $this->assertTrue($vd->validate(array('expr_field' => '5'))); + $this->assertFalse($vd->validate(array('expr_field' => '15'))); + } + + public function testCustomRuleXml() + { + $vd = new Validator(dirname(__FILE__).'/customrule.xml'); + + $this->assertTrue($vd->validate(array('regex_field' => 'abc'))); + $this->assertFalse($vd->validate(array('regex_field' => 'ABC'))); + + $this->assertTrue($vd->validate(array('enum_field' => 'a'))); + $this->assertFalse($vd->validate(array('enum_field' => 'd'))); + + $this->assertTrue($vd->validate(array('enum_field2' => 'a'))); + $this->assertFalse($vd->validate(array('enum_field2' => 'd'))); + + $this->assertTrue($vd->validate(array('expr_field' => '5'))); + $this->assertFalse($vd->validate(array('expr_field' => '15'))); + } + + public function testCondition() + { + $vd = new Validator(); + $data = array('greeting1'=>'hello'); + + // No condition + $vd->addFilter('greeting1', array('required'=>'true')); + $this->assertTrue($vd->validate($data)); + + // Now greeting2 being mandatory if greeting1 is 'Hello' + $vd->addFilter('greeting2', array('if'=>array('test'=>'$greeting1 == "Hello"', 'attr'=>'required', 'value'=>'true'))); + + // Because greeting1 is 'hello', including lowercase 'h', greeting2 isn't required yet. + $this->assertTrue($vd->validate($data)); + + // Change the value of greeting1. Greeting2 is required now + $data['greeting1'] = 'Hello'; + $this->assertFalse($vd->validate($data)); + + $data['greeting2'] = 'World'; + $this->assertTrue($vd->validate($data)); + } + + public function testConditionXml() + { + + $vd = new Validator(dirname(__FILE__).'/condition.xml'); + $data = array('greeting1'=>'hello'); + + $this->assertTrue($vd->validate($data)); + + // Change the value of greeting1. Greeting2 is required now + $data['greeting1'] = 'Hello'; + $this->assertFalse($vd->validate($data)); + + $data['greeting2'] = 'World'; + $this->assertTrue($vd->validate($data)); + + // javascript + $vd->setCacheDir(dirname(__FILE__)); + $js = $vd->getJsPath(); + $this->assertFileEquals($js, dirname(__FILE__).'/condition.en.js'); + } + + protected function tearDown() + { + // remove cache directory + $cache_dir = dirname(__FILE__).'/ruleset'; + if(is_dir($cache_dir)) + { + $files = (array)glob($cache_dir.'/*'); + foreach($files as $file) + { + unlink($file); + } + rmdir($cache_dir); + } + } +} + diff --git a/tests/classes/validator/condition.en.js b/tests/unit/classes/validator/condition.en.js similarity index 100% rename from tests/classes/validator/condition.en.js rename to tests/unit/classes/validator/condition.en.js diff --git a/tests/classes/validator/condition.xml b/tests/unit/classes/validator/condition.xml similarity index 100% rename from tests/classes/validator/condition.xml rename to tests/unit/classes/validator/condition.xml diff --git a/tests/classes/validator/customrule.xml b/tests/unit/classes/validator/customrule.xml similarity index 100% rename from tests/classes/validator/customrule.xml rename to tests/unit/classes/validator/customrule.xml diff --git a/tests/classes/validator/insertDocument.xml b/tests/unit/classes/validator/insertDocument.xml similarity index 100% rename from tests/classes/validator/insertDocument.xml rename to tests/unit/classes/validator/insertDocument.xml diff --git a/tests/classes/validator/login.xml b/tests/unit/classes/validator/login.xml similarity index 100% rename from tests/classes/validator/login.xml rename to tests/unit/classes/validator/login.xml