Skip to content

Instantly share code, notes, and snippets.

View chdemko's full-sized avatar

χristoφe Демко chdemko

View GitHub Profile
WEBVTT
00:11.000 --> 00:13.000
<v Roger Bingham>We are in New York City
00:13.000 --> 00:16.000
<v Roger Bingham>We're actually at the Lucern Hotel, just down the street
00:16.000 --> 00:18.000
<v Roger Bingham>from the American Museum of Natural History
@chdemko
chdemko / JApplicationWebRouterBaseTest.php
Created June 8, 2012 13:27
Replacement for parseRoute function
<?php
/**
* @package Joomla.UnitTest
* @subpackage Application
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
/**
@chdemko
chdemko / base.php
Created June 8, 2012 13:26
Replacement for parseRoute function
protected function parseRoute($route)
{
// Initialize variables.
$controller = false;
// Sanitize and explode the route.
$route = trim(parse_url($route, PHP_URL_PATH), ' /');
// If the route is empty then simply return the default route. No parsing necessary.
if ($route == '')
public function testParse_Url()
{
$url = 'http://localhost/joomla_development/j16_trunk/administrator/index.php?option=com_contact&view=contact&layout=edit&id=5';
$expected = parse_url($url);
$actual = JString::parse_url($url);
$this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal');
$url = 'http://joomla.org/mytestpath/È';
$expected = parse_url($url);
// Fix up path for UTF-8 characters
There were 3 errors:
1) JCryptCipher3DESTest::testDecrypt with data set #1 ('2.txt', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')
file_get_contents(/home/chdemko/Code/php/joomla/platform/git/tests/suite/joomla/crypt/cipher/stubs/encrypted/3des/2.txt): failed to open stream: No such file or directory
/home/chdemko/Code/php/joomla/platform/git/tests/suite/joomla/crypt/cipher/JCryptCipher3DESTest.php:89
2) JCryptCipherBlowfishTest::testDecrypt with data set #1 ('2.txt', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim v
/**
* Catch an error and throw an exception.
*
* @param integer $number Error level
* @param string $message Error message
*
* @return void
*
* @link https://bugs.php.net/bug.php?id=48147
*
@chdemko
chdemko / JFormTest.php
Created February 20, 2012 10:13
Fix unit test for JForm
public function testValidateField()
{
$form = new JFormInspector('form1');
$this->assertThat(
$form->load(JFormDataHelper::$validateFieldDocument),
$this->isTrue(),
'Line:'.__LINE__.' XML string should load successfully.'
);
@chdemko
chdemko / gist:1751107
Created February 6, 2012 09:43
setUserGroups
public static function setUserGroups($userId, $groups)
{
// Get the user object.
$user = JUser::getInstance((int) $userId);
// Set the group ids.
JArrayHelper::toInteger($groups);
// Set the titles for the user groups.
foreach ($groups as $group)
<?php
/**
* @package Joomla.UnitTest
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
/**
protected static function _getUserGroups()
{
// Get a database object.
$db = JFactory::getDBO();
// Get the user groups from the database.
$db->setQuery(
'SELECT a.id AS value, a.title AS text, b.id as parent'
. ' FROM #__usergroups AS a' . ' LEFT JOIN #__usergroups AS b ON a.lft >= b.lft AND a.rgt <= b.rgt'
. ' ORDER BY a.lft ASC, b.lft ASC'