phpbrew: awesome PHP version Manager

Automation
phpbrew PHPBrew is a awesome PHP version management tool. It is very similar to RVM for Ruby version management. Now it become very easy to manage PHP versions on Mac OSX. Let's get started with phpbrew, get it installed [crayon-58a985019760d391091824/] Now we have installed phpbrew and we can initialise it.   [crayon-58a9850197621014964647/] Now,  we can add ' source ~/.phpbrew/bashrc' to .bashrc or .zshrc profile. Now you can list all known php versions and install specific version of PHP we want [crayon-58a9850197629347751134/] This will install php5.6.13  Install PHP Extensions Using phpbrew, installing php extensions is such an easy task. You can name extensions and run command [crayon-58a9850197632943699872/] We can also enable/disable extensions with phpbrew [crayon-58a9850197639476775064/] Now, we also install php components line composer or phpunit  Turn Off You can turn off…
Read More

Modern Web Development and Dependency Management

Automation
Package Management Package management is a collection of the software packages which ease the process of installing, upgrading, deleting and configuring software packages from the project or computer operating system. As most of the web developers use Linux or Mac OSX for the web development, we have plenty of options HomeBrew Homebrew  is a package manage for OSX. Homebrew can be easily installed with Ruby with the following command. [crayon-58a98501998f0095208141/] Once installed, We can then install packages with simple command [crayon-58a9850199902989332851/] Packages installed with Homebrew are installed at "/usr/local/Cellar" directory in OSX. There are various options available for uninstall, list, search, update or upgrade brew packages. Usage and troubleshooting information just do [crayon-58a985019990a104627428/] MacPorts MacPorts is another package manager for the OSX. In order to install MacPorts, we need to have Xcode…
Read More

RESTful API Testing with Behat and Guzzle

BDD
Behat and Guzzle Behat is a behaviour driven development framework for the PHP application. Behat can be used for acceptance testing and api testing. Guzzle is PHP HTTP client to work with HTTP and web services. You can read more about Guzzle on the official website . We can use combination of the Behat and Guzzle for the testing of the REST API. In this post, we will see how to use Guzzle http  for testing GitHub web services. Behat in Action Let's do some action now. We will install behat, create feature simple file and implement step definitions. Installation & Config Let's create our composer.json to install all the dependencies with composer. [crayon-58a985019ab34935725731/] Now, we need to download composer and install all these dependencies [crayon-58a985019ab43059779144/] This will install all the dependencies in…
Read More

Behat Mink and headless ZombieJS [Updated]

BDD
Behat-Zombie Hope you had enjoyed my previous blog post about setting up Behat-Mink and Zombie driver. It was broken due to latest changes in the driver. Here are some updates, you need to do in order to get it working Upgrade Node [crayon-58a985019c081298172538/] Upgrade npm [crayon-58a985019c090168395355/] Once you upgrade node and npm then you need to update behat.yml pointing to node_module as shown in the video below. Watch Video Demo   https://www.youtube.com/watch?v=hyw7efbuKdc&feature=youtu.be  
Read More

PHP Continuous Integration Template using Composer and JenkinsCI

Automation
PHP-Jenkins Template Jenkins is a very popular Continuous Integration tool these days and using it with PHP project is became so easy with help of Jenkins-PHP  template  project. This project gives us ultimate guide to get started with basic setup of the PHP related tools and Jenkins plugins. You can install Jenkins on various platform, in my old blog post 'Adventures with JenkinsCI on Mac OSX and Linux' we have covered Jenkins installation. I got my JenkinsCI instance running on Mac OSX [http://localhost:8080] Install Jenkins-PHP Plugins Let's now install basic Jenkins plugins using Jenkins-CLI. In iTerm type following commands to install these required plugins: [crayon-58a985019c7b7980386091/] Here are some more useful plug-ins like phing, Ruby, RVM, PHP and Rake. You can install and restart Jenkins. [crayon-58a985019c7c5402183123/] Now, you should see something…
Read More

Running Behat Scenarios with PahntomJS

BDD
Behat Behat is a Behavior Driven Development tool for the PHP application. Behat and Mink uses many drivers like Selenium, Sahi, Zombie and goutte to launch scenarios. In this post, we will see how to run Behat scenarios using an awesome tool called 'PhantomJS'. We will use a existing Demo project on GitHub. [crayon-58a985019d399900401867/] PhantomJS PhantomJS is a headless browser with full support of JavaScript. PhantomJS can be used for the various purpose like Headless Website Testing Page Automation Network Monitoring Installation On Mac OSX, you can install it with HomeBrew [crayon-58a985019d3a8357462194/] You can now check if PhantomJS installed using [crayon-58a985019d3b0985914236/] Now you are good to go with PahntomJS and Behat Behat, Selenium and PhantomJS In order to use PhantomJS with Behat-Mink and Selenium. We need to launch it on…
Read More

Fixing ‘detect_unicode’ issue with Composer in OSX

Automation
Composer Composer is obviously great dependency management system for the PHP. Use of composer makes your life much easier while dealing with third party libraries. Sometimes, you will see issue while installing/downlng composer which looks like this : [crayon-58a985019e225640410484/] This issue is quite normal when you upgrade your OSX. Don't be panic, there is straight fix for this problem. Solution There are couple of solution to fix this issue on Mac OSX, Edit/rename your php.ini.default On Mac OSX, you will find your loaded php.ini at '/etc/php.ini.default' You can search for loaded config using [crayon-58a985019e237491220605/] Now, edit '/etc/php.ini.default' file and add " detect_unicode = Off" You also need to rename this file to 'php.ini' [crayon-58a985019e240255076363/] Restart the terminal and you are good to go ! Just in case you need temporary…
Read More

Running Cross browser BDD scenarios in Parallel with ANT

Automation, BDD
Cross-Browser BDD Scenarios Cross-Browser testing is a essential part of the automated test suite. While working with Behaviour Driven Development tools like Cucumber and Behat, we must have necessary setup to run BDD scenarios in parallel. Let's consider, we have test suite which runs in Firefox, Safari and Google in parallel. What an awesome idea ! In this tutorial we will we will see how to run cross-browser BDD scenarios in parallel using apache-ANT Apache ANT Apache ANT is a java based build tool. You can use another  build tools like phing Or maven but I like ANT as it's very simple to learn and so powerful. Install ANT There is complete installation guide on the apache ant website here. I think, you are smart enough to google it and get ANT installed on your…
Read More

Using Zombie.js Driver with Behat’s MinkExtension[Updated]

BDD
Zombie.js Zombie.js is a headless browser which uses Node.js, NPM, a C++ compiler and Python. We can use Zombie.js with Behat's MinkExtesion to make your BDD scenarios much faster. We have seen that we can also use Selenium, WebDriver, Sahi etc etc with MinkExtension. Here are few Benefits you can achieve using Zombie.js You don't need browser so your tests become so fast. You don't need to launch Server before running tests, Zombie will automatically do it for you, saving your time and efforts. Robust automated tests. Easy to setup on Linux and Mac OSX servers. Being honest, it was pain in everywhere until I got Zombie working in my local machine. I managed to get it working on Linux (Ubuntu) by taking help from Behat community, but faced many issues while getting…
Read More

Mobile Test Automation & Device Orientation with Behat & SauceLabs

BDD, iOSDev
Behat Supports Mobile Automation for Portarit & Landscape orientation with SauceLabs: Hope you enjoyed my Guest Blog post on official Sauce Labs blog about 'Testing Your Mobile Apps with Behat and SauceLabs'. We have seen how to run your BDD scenarios on the moble devices with use of Behat and SauceLabs combination. We have just added support for mobile test automation with Portrait, Landscape orientation and different device types. We have added more Saucelabs supported Selenium WebDriver desired capabilities to Mink Extention's Selenium2 Driver, so that we can run BDD scenarios both for Landscape and Portait orientation. This applies for iPhone, iPad and Android devices. Whats New in Desired Capabilities? deviceOrientation Now, It's possible to We run our scenarios with 'landscape' or 'portrait' devices. Default is 'Portrait'. Just by adding…
Read More