User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Test Driven Development is very important to improve quality and reduces bugs in your code. In this article I will show you how to use TDD in developing Joomla component. First you have to install phpunit, you can find the details at here. In this article we will use Joomla article manager (com_content) component as an experiment, and this article is based on Joomla 3.2.0. Here are the steps:

1. Create a Test folder

Create a new folder called Tests on /joomlapath/administrator/components/com_content folder. This folder will contain all test files.

2. Create phpunit configuration file

Create a new file called phpunit.xml. we will use the following configurations for this experiment: 

<phpunit bootstrap="bootstrap.php"
	colors="true"
	convertErrorsToExceptions="true"
	convertNoticesToExceptions="true"
	convertWarningsToExceptions="true"
	processIsolation="false"
	stopOnFailure="false"
	syntaxCheck="false"
	verbose="true">
</phpunit>

Read more ...

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

I got this error message when upgrading my joomla site to joomla 2.5.

Warning: require_once(Cache/Lite.php): failed to open stream: No such file or directory in joomlapath/libraries/joomla/cache/storage/cachelite.php on line 75 Fatal error: require_once(): Failed opening required 'Cache/Lite.php' (include_path='.:/usr/share/php:/usr/share/pear') in joomlapath/libraries/joomla/cache/storage/cachelite.php on line 75 

The source of this problem is in my configuration.php

public $smtpsecure = 'none';
public $smtpport = '25';
public $caching = '0';
public $cache_handler = 'cachelite';
public $cachetime = '15';
public $MetaDesc = '';
public $MetaKeys = '';
public $MetaTitle = '1';
public $MetaAuthor = '1';
public $robots = '';

so the solution is simple, just remove the 'cachelite' from $cache_handler variable :)

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

As a Joomla developer I usually put a module inside an article using loadposition code. The code is pretty simple: , but I can't find this functionality in Drupal 7, I don't know how to put a block inside an article in Drupal. So I ended adding this code to the page.tpl.php in my template.

$node = menu_get_object();
$nid = $node->nid;
$body = $page['content']['system_main']['nodes'][$nid]['body'];						
$content = $body['#object']->body['und'][0]['value'];
$argument_keys=null;
if (preg_match_all("/{loadposition ([\w-]+)}/", $content, $argument_keys)) {														
	$region = $argument_keys[1][0];		
	$region_name = block_get_blocks_by_region($region);																		
	$added_string = render($region_name); 	 							
	$newcontent = str_replace($argument_keys[0],$added_string,$content);									
}

if($newcontent==NULL)				
	print render($page['content']);												
else
	print $newcontent;

Read more ...