Jasa Pembuatan Aplikasi Murah Berkualitas
konsultasi gratis sekarang

Blog Posts

How to do test driven development for Joomla Component: Part 2

Test driven develoment

In the last tutorial we have created a unit test for the back end or administrator part of Joomla component and in this tutorial we will create a unit test for the front end or public part of Joomla component. In this tutorial we will use Joomla 3.2.x and Joomla article component (com_content) for experiment. So let’s start

1. Create a Test folder

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

2. Create phpunit configuration file

Create a new file called phpunit.xml in Tests folder. 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>


How to do test driven develoment for Joomla components

TDD TDD Joomla component Test driven develoment

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>