Example #1
0
	public function setUp() {
		Session::$site = 'http://www.test.info/';
		Session::$referrer = 'http://www.test.info/some/part/of/the/site';
		$config = new Config('config/tests.config.php');
		CoOrg::init($config, 'coorg/tests/mocks/app', 'coorg/tests/mocks/plugins');
		CoOrgSmarty::$vars = array();
	}
Example #2
0
	public function setUp()
	{
		parent::setUp();
		I18n::setLanguage('');
		Session::destroy();
		if ($s = UserSession::get())
		{
			$s->delete();
		}
		Session::$site = 'http://www.test.info/';
		Session::$referrer = 'http://www.test.info/some/part/of/the/site';
		unlink(COORG_TEST_CONFIG);
		copy(COORG_TEST_CONFIG_CLEAN, COORG_TEST_CONFIG);
		$config = new Config(COORG_TEST_CONFIG);
		$config->set('site/title', 'The Site');
		$config->set('defaultLanguage', '');
		CoOrg::init($config, 'app', 'plugins');
		CoOrgSmarty::clearAll();
		Header::$redirect = '__none__';
	}
Example #3
0
	public function testProcessPostRequestWrongReferer()
	{
		Session::$referrer = 'http://someothershit.com';
		CoOrg::process('alpha/post', array('p1' => 'value1',
		                                   'p2' => 'value2'), true);

		$this->assertEquals(Header::$errorCode, '500 Internal Server Error');
		$this->assertEquals('alpha/post', CoOrgSmarty::$vars['request']);
		$this->assertEquals('http://someothershit.com', CoOrgSmarty::$vars['referer']);
		$this->assertEquals('Wrong request method', CoOrgSmarty::$vars['exception']->getMessage());
		
		$this->assertEquals('extends:base.html.tpl|systemerror.html.tpl', CoOrgSmarty::$renderedTemplate);
	}