Beispiel #1
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'));
 }
Beispiel #2
0
 public function testAddPrefixedViews()
 {
     $res = Pluf_Dispatcher::addPrefixToViewFile('/alternate', Pluf::f('app_views'));
     $this->assertEquals('#^/alternate/$#', $res[0]['regex']);
     $this->assertEquals('Todo_Views', $res[0]['model']);
     $this->assertEquals('#^/alternate/install/$#', $res[1]['regex']);
 }
Beispiel #3
0
# 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.
 *
 * [parameters]
Beispiel #4
0
# 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());
Beispiel #5
0
 function testRecursif()
 {
     $GLOBALS['_PX_views'] = array(array('regex' => '#^/hello/$#', 'base' => '', 'model' => 'Pluf_Tests_Dispatch_Dispatcher', 'method' => 'hello3'), array('regex' => '#^/hello/#', 'base' => '', 'sub' => array(array('regex' => '#^world/$#', 'base' => '', 'model' => 'Pluf_Tests_Dispatch_Dispatcher', 'method' => 'hello'), array('regex' => '#^hello/$#', 'base' => '', 'model' => 'Pluf_Tests_Dispatch_Dispatcher', 'method' => 'hello4'))), array('regex' => '#^/hello1/#', 'base' => '', 'sub' => array(array('regex' => '#^world/$#', 'base' => '', 'model' => 'Pluf_Tests_Dispatch_Dispatcher', 'method' => 'hello1'))), array('regex' => '#^/hello2/#', 'base' => '', 'sub' => array(array('regex' => '#^world/$#', 'base' => '', 'model' => 'Pluf_Tests_Dispatch_Dispatcher', 'method' => 'hello2'))));
     $req1 = (object) array('query' => '/hello/world/');
     // match
     $req2 = (object) array('query' => '/hello/world');
     // match second pass
     $req3 = (object) array('query' => '/hello/you/');
     // no match
     $h1 = (object) array('query' => '/hello1/world/');
     // match
     $h2 = (object) array('query' => '/hello2/world/');
     // match
     $h3 = (object) array('query' => '/hello/');
     // match
     $h4 = (object) array('query' => '/hello/hello/');
     // match
     $this->assertIdentical(200, Pluf_Dispatcher::match($req1)->status_code);
     $this->assertEqual('ok', Pluf_Dispatcher::match($req1)->content);
     $this->assertIdentical(1, Pluf_Dispatcher::match($h1));
     $this->assertIdentical(2, Pluf_Dispatcher::match($h2));
     $this->assertIdentical(3, Pluf_Dispatcher::match($h3));
     $this->assertIdentical(4, Pluf_Dispatcher::match($h4));
     $this->assertIsA(Pluf_Dispatcher::match($req2), 'Pluf_HTTP_Response_Redirect');
     $this->assertIsA(Pluf_Dispatcher::match($req3), 'Pluf_HTTP_Response_NotFound');
     Pluf::loadFunction('Pluf_HTTP_URL_reverse');
     $this->assertEqual('/hello/world/', Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello'));
     $this->assertEqual('/hello1/world/', Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello1'));
     $this->assertEqual('/hello2/world/', Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello2'));
     $this->assertEqual('/hello/', Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello3'));
     $this->assertEqual('/hello/hello/', Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello4'));
 }