The book offers a wide variety of information about PHPUnit. At the very beginning it provides insights how to install PHPUnit and how to set up a development environment. Further, it elaborates on the question why to do tests and how to write code that can be tested easier. Finally it reaches its culmination with more business oriented techniques of “Functional Tests in the Browser using Selenium” and “Continuous Integration”.

Per site restriction is not possible by default in mediawiki, but there are many ways to create such environment mostly with using extensions. The most easy and flexible way without extensions is described on this page: http://meta.wikimedia.org/wiki/Regexp_wgWhitelistRead

It’s simply done by editing the file include/Title.php and find the line that looks like this in the function userCanRead(). In my version 1.16 it looked minimal different than at the link example:

PHP

1

2

3

4

5

6

7

8

9

$name=$this->getPrefixedText();

$dbName=$this->getPrefixedDBKey();

// Check with and without underscores

if(

in_array($name,$wgWhitelistRead,true)||

in_array($dbName,$wgWhitelistRead,true)

){

returntrue;

}

Replace them with the following lines:

1

2

3

4

5

6

7

8

$name=$this->getPrefixedText();

if(is_array($wgWhitelistRead)){

for($i=0;$i<count($wgWhitelistRead);$i++){

if(preg_match($wgWhitelistRead[$i],$name)){

returntrue;

}

}

}

Then you are able to use regular expressions in your $wgWhitelistRead which offers great opportunities.

The following code allows non-namespaced pages, Special:Search, Special:Categories pages and several Namespaces like: Help:*, Image:*, User:* and Category:* to be seen by anonymous users.

1

2

3

4

5

$wgWhitelistRead=array(

"/^[^:]*$/",

"/^Special:(Search|Categories)$/",

"/^(Help|Image|User|Category):/"

);

If you really have a private Wiki you might also want to remove Search and Categories, as they list also your private pages.

Contents

Introduction

I recently had the chance to take a look at the professional version of Codelobster PHP Edition. For those who may not know it: Codelobster is an IDE specialized on PHP development. Since HTML, CSS and JS are mostly always needed when working with PHP it also includes good support for them.

The IDE is available in two different versions a free one and a professional one. While the free version features mostly everything one might know from other IDEs, the professional version has some neat support for the most famous PHP CMSs (Drupal, Joomla and WordPress), Frameworks (Symfony, CakePHP, CodeIgniter, facebook API, yii framework, smarty), jQuery and an SQL Manager to make the developers life even more easier, than by just using those frameworks.

It is always a pain to create datasets for testing. I know the code should make it possible to test without using the database, but this is not always the case. Phpmyadmin offers a good possibility to create datasets by exporting the needed data from a database. The problem here is that the exported format does not match the format needed for phpunit. After digging a while in the net I found out, that there are converters to do this, but they are for older versions of phpmyadmin. Since version 3.3.0 they changed their xml format.

I recently started to work with symfony 2, a really nice PHP framework. Like Zend but with different concepts. While working with it I will line out some problems I had and solutions I found. This page will gradually be updated.

In my last article I wrote about the new Lambda functions of PHP 5.3. Today I will talk about another cool feature. Since PHP version 5.3 it is possible to let functions return objects. This makes chaining like in JavaScript possible.
It is fairly simple: the function just has to return $this in the end and the next function can be added via ->.Continue reading “PHP MySQL Chaining”

PHP 5.3 brought some new interesting stuff, I know its out for a while, but I recently started to love this new functionality. Lambda functions are anonymous functions knows as closures and they are really similar to the closures in JavaScript.

Working with Dates is always a problem. PHP just has a limited ability to work properly with dates, some things are not so easy too find. The PEAR Library offers a good amound of possibilities to work with dates, but the price is a massive loss of speed.

After searching a while I found 3 useful functions to work with weeks. Which I adapted to my needs.