PHP extension collections links

PHP extensions collections

http://windows.php.net/downloads/pecl/releases

https://github.com/stealth35/stealth35.github.com/downloads

http://www.hmelihkara.com/files/php_sqlsrv_55.rar

WinCache – Windows Cache Extension

XCache – binary downloads for Windows

Microsoft Drivers 3.0 for PHP for SQL Server

XDebug

Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)

How to read directory in PHP fast

We need to get a list of specific files from a directory.

Say we need to find all *.php files in our c:\inetpub\wwwroot folder. There are a couple of options to do it in PHP: opendir(), glob(), scandir() and RecursiveDirectoryIterator class. If we need to search through subfolders then the simplest solution in my opinion is to use the RecursiveDirectoryIterator class. Continue reading

How to mock different methods of the same class and how to mock one method with different arguments

I want to mock different methods of the same class and mock one method with different argument values. Using standard PHPUnit.

Mocks in PHPUnit are being created using getMock() method. It belongs to PHPUnit_Framework_TestCase class, that is described in .../PEAR/PHPUnit/Framework/TestCase.php file. Continue reading

How to integrate TeamCity with remote Mercurial through SSH

I have a couple of Merurial repos on BitBucket. And I have a CI TeamCity server on Windows. I want to integrate my local TeamCity with remote repos on BitBucket through SSH.

Ok, let’s start. As a precondition we should have PuTTY installed and added to PATH on TeamCity Windows server and a generated public/private SSH keys pair.
Continue reading

How to move from remote SVN to Mercurial

I was working with SVN quite a long time and was happy about it. But number of active projects increased and some of them were needed to be supported even while travels. Since that time I moved to decentralised version control system and have control over my code-sources even when I’m travelling and without internet connection.

For code hosting I use SourceForge.net for opencource projects and BitBucket.org for private projects. BitBucket.org supports both Git and Mercurial and allows 5 repo users for free. I prefer to work with Mercurial.

How to move a code repository from remote SVN server to Mercurial BitBucket?
Continue reading

How to create mock for a method with reference parameters

While testing PHP we need sometimes to create a mock for a method with reference parameters. I use returnCallback() from PHPUnit framework to to this. returnCallback() will call a function that imitates functionality of the original method. The original method can be either public or protected.
Continue reading