• 757-551-6373

Matthias Noback: A better PHP testing experience Part I: Moving away from assertion-centric testing

Matthias Noback has a new post today, part one in a series, looking at moving away from assertion-centric testing and more towards descriptive unit tests.

In the introduction article of this series I quickly mentioned that I think unit testing often focuses too much on assertions. […] I used to preach these things myself too (yes, “development with tests” often comes with a lot of preaching). But now I don’t follow these rules anymore. I will shortly explain my reasons. But before I do, let’s take a step back and consider something that is known as the Test framework in a tweet, by Mathias Verraes.

He breaks up the rest of the article into three sections, each with a few paragraphs of description and code where appropriate:

  • Something is the case, or not
  • Only one assertion for each test?
  • Write assertions first and then work towards them?

He talks about the idea of “Arrange Act Assert” and makes some recommendations as to how to be more descriptive in your tests and make them easier to read and follow in the future.

Link: http://php-and-symfony.matthiasnoback.nl/2014/07/descriptive-unit-tests/

Automate PHP with Phake – Introduction

On the SitePoint PHP blog there’s a new tutorial showing you how to automate your PHP development and deployment with Phake.

As developers, we often have to do repetitive tasks such as updating the database structure, seeding the database, writing CRUD code, running tests, and uploading files to a server. Wouldn’t it be great if we could automate these mundane tasks and proceed with solving the more important problems such as making our app more secure or more usable to our users? Phake, an automation tool written for PHP, can do those tasks for you.

They show you how to use Phake (not to be confused with this Phake) including getting it installed via Composer and the creation of a first Phakefile. The include examples of simple tasks, dependencies, grouping, adding descriptions and passing arguments. The command to run the tasks and the resulting output is also included.

Link: http://www.sitepoint.com/automate-php-phake-introduction/

Community News: Packagist Latest Releases for 07.07.2014

Recent releases from the Packagist:

Community News: Packagist Latest Releases for 07.06.2014

Recent releases from the Packagist:

Community News: Packagist Latest Releases for 07.05.2014

Recent releases from the Packagist:

PHP.net: PHP 5.6.0RC2 is available

The PHP development group has released the latest Release Candidate in the PHP 5.6.x series: PHP 5.6.0RC2. A reminder, though, this is not a production release, so only use it in testing.

The PHP development team announces the immediate availability of the second release candidate of PHP 5.6. As we entered the feature freeze with beta1, this is a bugfix-only release. All users of PHP are encouraged to test this version carefully, and report any bugs in the bug tracking system.

Several issues were fixed in this release candidate including updates to the core engine, internationalization, the PostgreSQL extension and the PHPDBG debugger functionality. You can find the full list in the NEWS file. You can download this latest release from the PHP QA site or the Windows QA site.

Link: http://php.net/index.php#id2014-07-03-1

NetTuts.com: A BDD Workflow With Behat and Phpspec

NetTuts.com has posted a new tutorial today showing a sample testing BDD workflow using the Behat and PHPSpec testing tools. The BDD (behavior-driven development) approach focuses on using test-driven development and domain-driven design rather than just a unit testing approach.

In this tutorial, we will have a look at two different BDD tools, Behat and phpspec, and see how they can support you in your development process. Learning BDD can be confusing. New methodology, new tools and many questions, such as “what to test?” and “which tools to use?”. I hope that this rather simple example will give you ideas to how you can incorporate BDD into your own workflow.

The article isn’t a “getting started with BDD” guide, so you’ll need to know a bit about the ideas and process before getting into it. He starts with a look at the workflow Taylor Otwell (his inspiration for this) uses and how to install Behat and get to work on a first feature file. He describes the thought process behind the steps and some of the PHP code required to make them work. He then gets to the use of phpspec to mock out a needed “Config” dependency. He works though the rest of the tests and includes the output when all tests are passing.

Link: http://code.tutsplus.com/tutorials/a-bdd-workflow-with-behat-and-phpspec–cms-21601

Developer’s Lane: Top 20 CakePHP Interview Questions and Answers

The Developer’s Lane site has posted a top ten list of questions answered about the CakePHP framework. The idea is that they could be used as a part of an interview to see how well the candidate knows the framework.

Here there are many questions and answers about How CakePHP Framework works? and basic questions related to CakePHP framework functionality.

Questions include:

  • What are are drawbacks of Cakephp?
  • What is the name of Cakephp database configuration file name and its location?
  • What are commonly used components of Cakephp?
  • Why does Cakephp have two vendor folders?
  • Can you remember what is the directory structure when you download Cakephp?

The questions provide a good overview of the framework, but won’t tell you if the developer is any good…you still need to figure out that one on your own.

Link: http://www.developerslane.com/top-20-cakephp-interview-questions-and-answers/

SitePoint PHP Blog: 13 Steps to Get eZ Publish 5.x to Work on Homestead

The SitePoint PHP blog has a new tutorial posted today showing how to get eZ Publish 5.x to Work on Laravel Homestead, a virtual machine environment from the creators of the Laravel framework.

This article was initially going to be a quick tip on how to install eZ Publish on Homestead in just a few steps. However, after I saw how much effort it took to get it up and working from scratch on a Vagrant box hosted on Windows, I decided to make it into a full article. I suffered, so you don’t have to.

He starts with a bit of an aside about “Vagrant-friendly applications and encourages developers to try to adopt a Vagrant-first approach to getting their systems working across multiple environments. From there he gets into the main part of the tutorial, showing you how to:

  • Install “Homestead Improved”
  • Set up and configure a new site
  • Install dependencies and the latest version of eZ Publish
  • Fix a few issues on installation and “hack the guts” to make some things
  • Change some configuration settings to make the install work correctly
  • Go through the installer to set up the application (and database)
  • Change the web server configuration to remove the need for “index.php”

Screenshots and commands/code needed to make the updates are all included in the post.

Link: http://www.sitepoint.com/13-steps-get-ez-publish-5-x-homestead/

Community News: Packagist Latest Releases for 07.04.2014

Recent releases from the Packagist:

Creative Solutions for Extraordinary Clients