Example #1
0
<?php

// early out if the userid arg is missing
if (!isset($_REQUEST['userid'])) {
    return json_encode(array('status' => 'invalidargs'));
}
// include fakememcache here, as a convenience
require_once dirname(__FILE__) . '/fakememcache.php';
// If XML_Serializer is not already in the include_path, dynamically add the
// folder that is bundled with this sample that includes a copy of XML_Serializer
// (along with its own dependencies).
if (!in_include_path('XML/Serializer.php')) {
    set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear');
}
// initialize split here, since all services will include this code
require_once dirname(__FILE__) . '/Splyt/Splyt.php';
// We must always initialize Splyt before use with either a user id, a device id, or both.  In
// the case of BubblePop, we use only a user id
$splyt = Splyt::init('rsb-bubblepopphp-test', $_REQUEST['userid']);
/**
 * Determines whether a file is found in the PHP include path.
 *
 * @param $file The file to find.
 *
 * Newer PHP versions could use stream_resolve_include_path(); this function
 * is provided in case we're running on an older version.
 */
function in_include_path($file)
{
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $found = false;
Example #2
0
function in_include_path($filename)
{
    $paths = explode(PATH_SEPARATOR, get_include_path());
    foreach ($paths as $path) {
        if (substr($path, -1) != DIRECTORY_SEPARATOR) {
            $path .= DIRECTORY_SEPARATOR;
        }
        if (file_exists($path . $filename)) {
            return TRUE;
        }
    }
    return FALSE;
}
// PHPUnit 3.5 complains about including PHPUnit/Framework.php, but
// 3.4 doesn't have PHPUnit/Autoload.php
if (in_include_path('PHPUnit/Autoload.php')) {
    require_once 'PHPUnit/Autoload.php';
} else {
    require_once 'PHPUnit/Framework.php';
}
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Extensions/OutputTestCase.php';
date_default_timezone_set('America/New_York');
error_reporting(E_ALL | E_STRICT);
$_SERVER['SERVER_NAME'] = 'example.com';
$_SERVER['REQUEST_URI'] = '/index.php';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SERVER_PORT'] = 80;
if (empty($_SERVER['DOCUMENT_ROOT'])) {
    $_SERVER['DOCUMENT_ROOT'] = realpath(dirname(__FILE__) . '/../');
}