Ejemplo n.º 1
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $m = (require dirname(__FILE__) . '/relations.php');
     $GLOBALS['_PX_models'] = array_merge($m, $GLOBALS['_PX_models']);
     $GLOBALS['_PX_config']['pluf_use_rowpermission'] = false;
     $db = Pluf::db();
     $schema = Pluf::factory('Pluf_DB_Schema', $db);
     $m1 = new TestModel();
     $m2 = new RelatedToTestModel();
     $m3 = new RelatedToTestModel2();
     $m4 = new TestModelRecurse();
     $schema->model = $m1;
     $schema->dropTables();
     $schema->createTables();
     $schema->model = $m2;
     $schema->dropTables();
     $schema->createTables();
     $schema->model = $m3;
     $schema->dropTables();
     $schema->createTables();
     $schema->model = $m4;
     $schema->dropTables();
     $schema->createTables();
 }
Ejemplo n.º 2
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     Pluf::loadFunction('Pluf_HTTP_URL_buildReverseUrl');
     Pluf::loadFunction('Pluf_HTTP_URL_reverse');
     $d = new Pluf_Dispatcher();
     $d->loadControllers(Pluf::f('app_views'));
 }
Ejemplo n.º 3
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $this->db = Pluf::db();
     if ($this->db->engine != 'SQLite') {
         $this->markTestSkipped('Only to be run with the SQLite DB engine');
     }
 }
Ejemplo n.º 4
0
 protected function setUp()
 {
     $this->markTestSkipped('Need to rewrite the form handling.');
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $db = Pluf::db();
     $schema = Pluf::factory('Pluf_DB_Schema', $db);
     $m1 = new TestFormModel();
     $schema->model = $m1;
     $schema->dropTables();
     $schema->createTables();
 }
Ejemplo n.º 5
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $db = Pluf::db();
     $schema = Pluf::factory('Pluf_DB_Schema', $db);
     $models = array('Pluf_Group', 'Pluf_User', 'Pluf_Permission', 'Pluf_Message', 'Pluf_RowPermission');
     foreach ($models as $model) {
         $schema->model = Pluf::factory($model);
         $schema->dropTables();
         if (true !== ($res = $schema->createTables())) {
             throw new Exception($res);
         }
     }
     $perms = array();
     for ($i = 1; $i <= 10; $i++) {
         $perm = new Pluf_Permission();
         $perm->application = 'DummyModel';
         $perm->code_name = 'code-' . $i;
         $perm->name = 'code-' . $i;
         $perm->description = 'code-' . $i;
         $perm->create();
         $perms[] = clone $perm;
     }
     $groups = array();
     for ($i = 1; $i <= 10; $i++) {
         $group = new Pluf_Group();
         $group->name = 'Group ' . $i;
         $group->description = 'Group ' . $i;
         $group->create();
         $groups[] = clone $group;
     }
     $groups[0]->setAssoc($perms[0]);
     $groups[0]->setAssoc($perms[1]);
     $groups[0]->setAssoc($perms[2]);
     $groups[0]->setAssoc($perms[3]);
     $groups[1]->setAssoc($perms[0]);
     //again perm "1"
     $groups[0]->setAssoc($perms[4]);
     $groups[0]->setAssoc($perms[5]);
     $user = new Pluf_User();
     $user->login = '******';
     $user->first_name = 'test';
     $user->last_name = 'test';
     $user->email = '*****@*****.**';
     $user->setPassword('test');
     $user->active = true;
     if (true !== $user->create()) {
         throw new Exception();
     }
     $user->setAssoc($groups[0]);
     $user->setAssoc($groups[1]);
     $user->setAssoc($perms[7]);
     $user->setAssoc($perms[8]);
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     parent::__construct("Test the monotone class.");
     $this->tmpdir = sys_get_temp_dir() . "/mtn-test";
     $this->dbfile = "{$this->tmpdir}/test.mtn";
     set_include_path(get_include_path() . ":../../../pluf-master/src");
     require_once "Pluf.php";
     Pluf::start(dirname(__FILE__) . "/../conf/idf.php");
     // Pluf::f() mocking
     $GLOBALS['_PX_config']['mtn_repositories'] = "{$this->tmpdir}/%s.mtn";
 }
Ejemplo n.º 7
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $db = Pluf::db();
     $schema = Pluf::factory('Pluf_DB_Schema', $db);
     $m1 = new TestFormModel();
     $schema->model = $m1;
     $schema->dropTables();
     $schema->createTables();
     for ($i = 1; $i < 11; $i++) {
         $m = new TestFormModel();
         $m->title = 'My title ' . $i;
         $m->description = 'My description ' . $i;
         $m->create();
     }
 }
Ejemplo n.º 8
0
        $config = $app . '/conf/' . strtolower($app) . '.test.php';
    }
} else {
    echo 'Error: This script can only be run from the command line.' . "\n";
    exit(1);
}
echo sprintf('Application: %s ', $app);
if (!file_exists($config)) {
    echo sprintf("\n" . 'Error, the config file does not exists: %s' . "\n", $config);
    exit(1);
} else {
    echo sprintf('(%s)' . "\n", $config);
}
define('IN_UNIT_TESTS', true);
require 'Pluf.php';
Pluf::start($config);
$simple_test = Pluf::f('simple_test_path', false);
if (false == $simple_test) {
    e('Error, the path to the simple test framework is not defined.');
    e('Download simple test from:');
    e('   http://simpletest.sourceforge.net/');
    e('Extract the archive on your system and set the "simple_test_path"');
    e('configuration variable in your configuration file.');
    e('For example: $cfg[\'simple_test_path\'] = \'/home/you/simpletest\'; ');
    exit(1);
}
$testfolder = $app . '/Tests/';
if (!file_exists($testfolder)) {
    e(sprintf('The test folder does not exists: %s.', $app . '/Tests/'));
    exit(1);
}
Ejemplo n.º 9
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# ***** END LICENSE BLOCK ***** */
/**
 * This script will send the notifications after a push in your 
 * repository.
 */
require dirname(__FILE__) . '/../src/IDF/conf/path.php';
require 'Pluf.php';
Pluf::start(dirname(__FILE__) . '/../src/IDF/conf/idf.php');
Pluf_Dispatcher::loadControllers(Pluf::f('idf_views'));
/**
 * [signal]
 *
 * mtnpostpush.php::run
 *
 * [sender]
 *
 * mtnpostpush.php
 *
 * [description]
 *
 * This signal allows an application to perform a set of tasks
 * after a push to a monotone repository.
 *
Ejemplo n.º 10
0
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Plume Framework is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# ***** END LICENSE BLOCK ***** */
// Set the include path to have Pluf in it.
// If you have Pluf in your include path, you do not need that
$path_to_Pluf = dirname(__FILE__) . '/../../../src';
$path_to_Todo = dirname(__FILE__) . '/../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path_to_Pluf . PATH_SEPARATOR . $path_to_Todo);
// Load Pluf
require 'Pluf.php';
// Start the framework with the todo app configuration.
Pluf::start($path_to_Todo . '/Todo/conf/todo.php');
// As we are using a dispatcher, we need to load the corresponding
// view controllers. The controllers are just a mapping between the query
// string and corresponding classes and methods.
Pluf_Dispatcher::loadControllers(Pluf::f('todo_urls'));
// Dispatch the call. Note that the use of a dispatcher is not
// mandatory at all, you can create any number of .php file to dispatch
// manually. A dispatcher enables the use of only one index.php file.
Pluf_Dispatcher::dispatch(Pluf_HTTP_URL::getAction());
Ejemplo n.º 11
0
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# ***** END LICENSE BLOCK ***** */
/**
 * Migration script.
 */
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__));
require 'Pluf.php';
function usage()
{
    echo 'Usage examples:' . "\n" . ' Extract all:      extracttemplates.php path/to/config.php path/to/outpudir' . "\n";
}
function debug($what)
{
    global $debug;
    if ($debug) {
        echo $what . "\n";
    }
}
if ($argc !== 3) {
    usage();
    die;
}
$conf = $argv[1];
$outputdir = $argv[2];
Pluf::start($conf);
$generator = new Pluf_Translation_Generator();
$generator->generate($outputdir);
echo 'Done', "\n";
Ejemplo n.º 12
0
 public function testStart()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $this->assertEquals(true, isset($GLOBALS['_PX_config']));
     $this->assertEquals(false, $GLOBALS['_PX_config']['test']);
 }
Ejemplo n.º 13
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . '../../src');
require 'Pluf.php';
Pluf::start(dirname(__FILE__) . '/Hello/conf/hello.php');
Pluf_Dispatcher::loadControllers(Pluf::f('hello_urls'));
Pluf_Dispatcher::dispatch(Pluf_HTTP_URL::getAction());
Ejemplo n.º 14
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     @mkdir($this->output);
 }
Ejemplo n.º 15
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
     $this->filter = new Pluf_Text_HTML_Filter();
 }
Ejemplo n.º 16
0
 protected function setUp()
 {
     Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
 }
Ejemplo n.º 17
0
<?php

$path_to_pluf = '/home/phoenix1/pluf';
$path_to_app = dirname(__FILE__);
set_include_path($path_to_pluf . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR);
// Load Pluf
require 'Pluf.php';
Pluf::start(dirname(__FILE__) . '/config.php');
Pluf_Dispatcher::loadControllers(dirname(__FILE__) . '/urls.php');
Pluf_Dispatcher::dispatch(Pluf_HTTP_URL::getAction());
Ejemplo n.º 18
0
}
// control the arguments.
if ('' == $what['conf'] or !file_exists($what['conf']) or $what['all'] == false and $what['app'] == '') {
    echo 'Error: Missing what to do or config file.' . "\n";
    usage();
    die;
}
if ($what['all'] and $what['version'] !== null) {
    echo 'Error: -a and -v --version cannot be used together.' . "\n";
    echo '       Run the migration to a given version indenpendtly' . "\n";
    echo '       for each application.' . "\n";
    usage();
    die;
}
require 'Pluf.php';
Pluf::start($what['conf']);
if (PHP_SAPI != 'cli' and Pluf::f('migrate_allow_web', false)) {
    echo 'Error: This script can only be run from the command line.' . "\n";
    exit;
}
debug('PHP include path: ' . get_include_path());
if ($what['un-install']) {
    $apps = array();
    if ($what['all']) {
        $apps = Pluf::f('installed_apps');
    } else {
        $apps = array($what['app']);
    }
    echo 'Applications to uninstall: ' . implode(', ', $apps) . "\n";
    echo 'Please confirm that you want to uninstall by typing "yes": ';
    $line = trim(fgets(STDIN));