News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Engine Yard Blog:
Composer & Continuous Integration
April 29, 2015 @ 09:14:11

In a new post to the Engine Yard blog Nils Adermann provides an overview of using Composer with continuous integration, its role in the overall process and some good practices to follow in its use.

Continous Integration (CI) is the practice of continuously (and automatically) testing every change a developer makes. So automated tests become an integral part of the development process providing direct feedback on changes made. [...] Davey Shafik's article on Composer's Lock File explains the typical usage of composer install and update. The key takeaway is that developers should run composer update manually to explicitly update individual dependencies while composer install should be used in automated processes. This principle includes automated test environments.

He points out that using the lock file method reproduces the vendor directory exactly as it is in production and what it means for failures in your automated tests. He also talks about methods to improve the build performance to reduce time spent during the generation of the environment, including the use of the Composer cache data. He includes a few flags you can pass to Composer to reduce not only the libraries it installs but also how it fetches their contents.

0 comments voice your opinion now!
composer continuous integration build process performance automated test composerlock

Link: https://blog.engineyard.com/2015/composer-continuous-integration

Alex Bilbie:
Setup Jenkins and test a PHP project
April 20, 2015 @ 10:14:32

Alex Bilbie has posted a new tutorial to his site showing you how to set up Jenkins to test a PHP project. Jenkins is a popular automated build tool that can be used to do helpful things like automatically run unit tests and execute other tasks when code changes happen (or on an automated schedule).

After a chat with some other developers on Twitter the other day I offered to write a tutorial on how to setup Jenkins from scratch and create a job to test a PHP project. For this tutorial I'm going to use a Digital Ocean droplet (get $10 free credit with this link) but you can use a server from anywhere. Once I've installed and setup Jenkins I'm going to create a job to test my Proton framework.

He walks you through the setup of the server (Ubuntu running on a Digital Ocean instance) and the commands you'll need to get the required tools installed, including Jenkins. He configures Nginx to work as a proxy for the Jenkins installation (config included) and how to secure the installation. This is done via a GitHub OAuth connection and plugin. He helps you get Composer installed, an SSH in place for committing back to GitHub and creating a first job. He also includes a listing of several helpful tools that can be used to test your scripts and applications to provide more detail and better quality to the resulting code.

0 comments voice your opinion now!
jenkins test setup project tutorial digitalocean ubuntu

Link: http://alexbilbie.com/2015/04/setting-up-jenkins/

Full Stack Radio:
13 Phil Sturgeon - Designing and Testing APIs, Go and PHP 7
April 06, 2015 @ 08:58:54

The Full Stack radio podcast has posted their thirteenth episode with guest Phil Sturgeon. In this latest show they talk about designing APIs, Go and PHP 7.

n this episode, Adam talks to Philip J. Sturgeon about designing and testing APIs at Ride. They also talk about building microservices with Go, and some of the new features coming in PHP 7.

You can listen to this latest episode either through the audio player in the post or by downloading the mp3 of the episode for listening at your leisure. Be sure to subscribe to their feed if you enjoy the episode too!

0 comments voice your opinion now!
fullstackradio philsturgeon api go php7 podcast deign test

Link: http://fullstackradio.com/episodes/13/

Cody Kennedy-Darby:
Testing Your Current Code Against PHP7 Or HHVM
April 01, 2015 @ 08:49:11

On Medium.com Cory Kennedy-Darby has a quick post showing you how you can test your current code against the latest versions of PHP 7 with the help of DUnit.

DUnit (dee-unit) makes your life easier by allowing you to run your unit tests on different versions of PHP or HHVM. Different versions are possible by using Docker containers. Thanks to @danbruce each of the Docker containers are only, ~35 MB in size. [...] PHP7 isn't that far away. In fact, it is scheduled for release in ~8 months in November. Now is the perfect time to start testing your code against PHP7 nightly.

He starts with a few reasons you might want to test your code and things you can do to start "thinking forward" to when it is released. He then shows you how to install DUnit (more detail here) and use it to test on both PHP 7 and HHVM builds.

0 comments voice your opinion now!
nightly test unittest build dunit docker container php7 hhvm

Link: https://medium.com/@ckdarby/testing-your-current-code-against-php7-or-hhvm-2f0ab059af78

Rob Allen:
Building and testing the upcoming PHP7
March 30, 2015 @ 10:14:08

Rob Allen has posted a guide to building and testing PHP 7, the next upcoming major build of the PHP language (released sometime later this year).

The GoPHP7-ext project aims to ensure that all the known PHP extensions out there work with the upcoming PHP 7. This is non-trivial as some significant changes have occurred in the core PHP engine (related to performance) that mean that extensions need to be updated. In order to help out (and prepare my own PHP code for PHP 7!), I needed the latest version of PHP7 working in a vagrant VM. Fortunately Rasmus has created a such a VM called php7dev, so let's start there.

He walks you through the process of grabbing the latest version of the virtual machine and set it up as a Vagrant VM instance. He talks about the different PHP versions contained in the VM and how to update PHP 7 to the latest pre-release version. Finally he talks about building an extension on the VM (he uses the apfd extension) and how to configure the VM to be able to test your own code too.

0 comments voice your opinion now!
php7 test vm extension rasmuslerdorf vagrant tutorial

Link: http://akrabat.com/building-and-testing-php7/

Freek Lijten:
Testing PHP extensions - what makes a good test
March 23, 2015 @ 09:52:58

Freek Lijten has a new post today continuing his look at the world of PHP extensions and focusing in on testing this time. He hopes to answer the question of what makes a good, effective set of tests to help increase the stability and quality of the extensions you write.

In my previous blog I took you through the process of getting PHP and extensions compiled, generating code coverage and running tests. What I did not talk about was what makes a good test. I hope to correct on this by adding this post and going into more detail on the actual writing of tests itself.

Using the same extension as before (enchant) he goes through the addition of a test for the enchant_dict_add_to_session function. He start by showing how much the function is currently tested (hint: none) and code coverage. He points out that 100% coverage is just one metric in a set that should be considered and not the final goal. He shares a simple test for the function that checks to see if a certain word exists in a dictionary. The coverage report shows all lines being executed, but there's a lot not tested, at least conceptually. He shows how to test "the spirit" of the function with additional tests for non-existent words, spell checking and if a word is not in the dictionary at all. PHP example code shows these tests kinds of tests to illustrate the steps he's talking about.

0 comments voice your opinion now!
test extension phpt spirit codecoverage metric goal

Link: http://www.freeklijten.nl/home/2015/03/22/Testing-PHP-extensions-what-makes-a-good-test

Stephan Hochdörfer:
Running PHPUnit via Phing on HHVM
February 26, 2015 @ 09:16:58

Stephan Hochdörfer has a quick post showing how he has PHPunit up and working on an HHVM instance. His problem was that the tests were actually executing using the "php" binary, not the HHVM one.

For quite some time we run the unit tests for our libs and tools against PHP and HHVM, at least that is what I thought up to now. As it turns out I missed a minor detail. [...] What happens now is that Phing is executed via HHVM but PHPUnit will still be executed via the PHP binary because the PHPUnit shell script will look for the php binary in the PATH configuration. Since we run HHVM side-by-side with PHP on our Jenkins build nodes I was not able to point /usr/bin/php to /usr/bin/hhvm - which would be the easiest and cleanest solution. I

He shares the workaround he created, creating a symbolic link between the hhvm and php binaries and then executing the Phing task to run the tests. This is being run via Jenkins and uses it's "WORKSPACE" as a container so the main "php" binary isn't overwritten.

0 comments voice your opinion now!
hhvm phpunit test unittest execute binary path jenkins phing task

Link: https://blog.bitexpert.de/blog/running-phpunit-via-phing-on-hhvm/

Dave Marshall:
Probing Test Suite Quality with Mutation Testing
January 08, 2015 @ 12:09:42

In this recent post to his site Dave Marshall looks at a method for evaluating the overall quality of your suite of unit tests with help from mutation testing.

100% code coverage should never really be a goal. [...] I feel pursuing 100% coverage in a PHP project is a particularly poor idea as our tooling generally only provides Line Coverage. [...] There are more reasonable coverage metrics to use to measure the quality of a test suite. Sebastian Bergmann and Derick Rethans are working hard on bringing some of these options to us, but for now we're limited to line coverage.

He talks about the difference between line, branch and condition coverage types (with code examples) and which allows for more effective and quality tests to be written. He then talks about the results of an experiment to achieve 100% coverage on the Router component in the Aura project. He found the problem using mutation testing - changing values in the production code to make sure the tests break. He also links over to a new mutation testing tool that's been released to help with this kind of thing, humbug, and some of the results it can report.

Mutation testing is a great thing to have a grasp of in theory, but it's not particularly easy to practice. The tools are very hard to write and then their output is often hard to understand or interpret effectively. I wouldn't recommend practicing with mutation testing on a regular basis, but it's certainly worth considering on the odd occasion.
0 comments voice your opinion now!
test suite quality mutation testing unittest coverage

Link: http://davedevelopment.co.uk/2015/01/07/probing-test-suite-quality-with-mutation-testing.html

Matthieu Napoli:
Test against the lowest Composer dependencies on Travis
December 18, 2014 @ 10:53:58

Recently the "prefer-lowest" option of Composer was mentioned in relation to testing for Symfony-based applications. In this new post to his site Matthieu Napoli shows how you can do it on any project that uses the Travis-CI continuous integration service.

Composer just got a new awesome addition thanks to Nicolas Grekas: prefer the lowest versions of your dependencies. [...] This amazing option will install the lowest versions possible for all your dependencies. What for? Tests of course!

He includes all the instructions you'll need to get your Travis build using this command line option, starting with testing it on your own system first. He shows a basic ".travis.yml" file with the configuration you'll need to provide it use the "prefer-lowest" (check out line 17). He does point out that you'll need to run a "composer self-update" first though, as Travis hasn't quite caught up with the latest Composer that includes this option.

0 comments voice your opinion now!
test lowest dependency version composer travisci tutorial

Link: http://mnapoli.fr/test-lowest-dependencies/

Imagine Easy Solutions Blog:
Testing Logging in Silex
November 12, 2014 @ 11:34:50

On the Imagine Easy Solutions blog Yitzchak Schaffer talks some about logging in Silex by making use of a MonologServiceProvider. You can find the end result of his setup in this GitHub repository.

Silex is a PHP microframework from the same family as Symfony. My shop, Imagine Easy Solutions, uses Silex for some of our most important applications. Modular setup is at the core of Silex's game, by means of Service Providers. The MonologServiceProvider makes it easy to add highly configurable logging to your application. But how to test your logging? It turns out that this Service Provider includes a DebugHandler which you can use to make log entries available in array form.

He walks you through the integration of the service provider via a "debug handler" and configuring it in the setup method. He also includes an "assertLogEntry" method to evaluate the current logs and check to ensure an entry was made. Finally, he puts it to use via a "notOk" method.

0 comments voice your opinion now!
test logging silex serviceprovider monolog tutorial

Link: http://dev.imagineeasy.com/post/102394035784/testing-logging-in-silex


Community Events

Don't see your event here?
Let us know!


series podcast introduction laravel language composer example symfony interview part2 yii2 community application php7 opinion programming list framework project api

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework