Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b613a8b906
Fetching contributors…

Cannot retrieve contributors at this time

226 lines (209 sloc) 7.574 kb
<?php
/**
*
* License, TERMS and CONDITIONS
*
* This software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
* Please read the license here : http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* ATTRIBUTION REQUIRED
* 4. All web pages generated by the use of this software, or at least
* the page that lists the recent questions (usually home page) must include
* a link to the http://www.lampcms.com and text of the link must indicate that
* the website\'s Questions/Answers functionality is powered by lampcms.com
* An example of acceptable link would be "Powered by <a href="http://www.lampcms.com">LampCMS</a>"
* The location of the link is not important, it can be in the footer of the page
* but it must not be hidden by style attributes
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This product includes GeoLite data created by MaxMind,
* available from http://www.maxmind.com/
*
*
* @author Dmitri Snytkine <cms@lampcms.com>
* @copyright 2005-2012 (or current year) Dmitri Snytkine
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
* @link http://www.lampcms.com Lampcms.com project
* @version Release: @package_version@
*
*
*/
/**
* Order of tests:
* LampcmsObject X
* Validate
* LampcmsArray X
* ArrayDefaults X
* String X
* Utf8String X
* Dom\Document
* String\HTMLString
* String\HTMLStringParser
* Ini X
* Mongo X
* Incrementor X
* Mongo\Doc X
* Resource X
* Request X
* Responder <- use @outputBuffering true
* Registry X
* Dispatcher
* HtmlSafe
* Template
*
*
* User X
* Answer X
* UnansweredTags
* UserTags
* RelatedTags
*
* Tokenizer
* TagsTokenizer
* TitleTokenizer
* Question X
*
* SubmittedAnswerWWW
* SubmittedQuestionWWW
* SubmittedCommentWWW
* AnswerParser
* QuestionParser
*
*
* Acl
* Base
* UserAuth
* WebPage
*
*
* Then
* loop over dirs but exclude Template, Dom and String from test suite
* since these has been tested already, and also
* exclude Interfaces
*/
/**
* Define constants that
* are normally defined in !inc.php
* because we not including !inc.php for tests
*
*/
define('LAMPCMS_DEBUG', false);
define('LAMPCMS_SALT', 'abcde');
define('LAMPCMS_COOKIE_SALT', 'abcde');
define('DEFAULT_LANG', 'en');
define('LAMPCMS_COOKIE_DOMAIN', '');
define('SITE_URL', '');
//define('LAMPCMS_IMAGE_SITE', 'http://img.lampcms.com');
//define('LAMPCMS_AVATAR_IMG_SITE', 'http://img.lampcms.com');
/**
* This is very important!
* Use test databases!
* If this step if overlooked then
* the actual database will be used during
* test, and can override some actual data!
* There is a safeguard in place to prevent
* from dropping the actual databse during test
* but there is no safeguared for accidentally
* overriding actual data here and there
*/
define('MONGO_DBNAME', 'LAMPCMS_TEST');
define('LAMPCMS_MYSQL_DB', 'LAMPCMS_TEST');
/**
* LAMPCMS_PATH may be defined
* in Eclipse in External Tools Configuration
* > Enviromnent just add LAMPCMS_PATH and
* point value to the root dir of your project
* This is my value: C:\eclipse\workspace\QA
* ..
*
* To Run individual tests in Eclipse set
* External Tools Configuration > Working Directory
* to location of this dir (/tests), this is my config:
* ${workspace_loc:/QA/tests}
*
* To run test suite it's different, I setup second "External Tool"
* called it TestSuite
* and there I don't have Environment variable at all,
* and the Working directory is pointed to
* ${workspace_loc:/QA}
* The phpunit.xml file is located there so phpunit
* picks it up and takes it from there
* @var string
*/
$path = getenv('LAMPCMS_PATH');
if (!defined('LAMPCMS_PATH')) {
if ($path) {
define('LAMPCMS_PATH', $path);
} else {
define('LAMPCMS_PATH', './'); // this looks wrong maybe? Why path is this dir?
}
}
define('LAMPCMS_WWW_DIR', LAMPCMS_PATH . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR);
define('LAMPCMS_DATA_DIR', LAMPCMS_WWW_DIR . 'w' . DIRECTORY_SEPARATOR);
/**
* Set all the multibyte
* functions to use UTF-8
* as internal encoding
*/
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding("UTF-8");
}
/**
* if php NOT running as fastcgi
* then we need to create a dummy function
*
*/
if (!function_exists('fastcgi_finish_request')) {
define('NO_FFR', true);
function fastcgi_finish_request()
{
}
}
$libDir = LAMPCMS_PATH . DIRECTORY_SEPARATOR . 'lib';
$lampcmsClasses = $libDir . DIRECTORY_SEPARATOR . 'Lampcms' . DIRECTORY_SEPARATOR;
require 'LampcmsUnitTestCase.php';
require $lampcmsClasses . 'Interfaces' . DIRECTORY_SEPARATOR . 'All.php';
require $lampcmsClasses . 'Exception.php';
require $lampcmsClasses . 'Object.php';
require $lampcmsClasses . 'SplClassLoader.php';
require LAMPCMS_PATH . DIRECTORY_SEPARATOR . 'Points.php';
require $lampcmsClasses . 'Mongo' . DIRECTORY_SEPARATOR . 'Collections.php';
require LAMPCMS_PATH . DIRECTORY_SEPARATOR . 'Mycollections.php';
function d($message)
{
}
function e($message)
{
}
if (!function_exists('apache_request_headers')) {
function apache_request_headers()
{
$JSON_ENCODED_HEADERS = '{"Host":"127.0.0.5","User-Agent":"Mozilla\/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko\/20100824 Firefox\/3.6.9 GTB7.1","Accept":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8","Accept-Language":"en-us,en;q=0.5","Accept-Encoding":"gzip,deflate","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.7","Keep-Alive":"115","Connection":"keep-alive","Cookie":"sid=1297206315.3591az0q354fEdcp96s6ulBwtQcGf81sDo35G; PHPSESSID=roqvm4i871og6u3msurp4d5qh0","Cache-Control":"max-age=0"}';
$a = json_decode($JSON_ENCODED_HEADERS, true);
return $a;
}
} else {
define('HAS_APACHE_REQUEST_HEADERS', true);
}
require LAMPCMS_PATH . DIRECTORY_SEPARATOR . 'autoload.php';
session_start();
Jump to Line
Something went wrong with that request. Please try again.