Skip to main content

Using PhantomJS with PHPUnit

I found it pretty hard to get PHPUnit working with PhantomJS so thought I'd put together a quick tutorial.

Step 1: Make sure you have the following dependencies in your composer.json and run composer update:
"require-dev": { 
      "facebook/webdriver": "dev-master",  
       "phpunit/phpunit": "4.0.*", 
       "phpunit/phpunit-selenium": ">=1.2" 
}
Step 2: Download PhantomJS and Selenium Server and put them in a new directory 'bin' in your tests folder. (Might not be the most optimum place to stash them but it works for now)

Step 3: Add the following code to your tests folder as TestScaffold.php. It will start the Selenium server if it's not already running and boot up PhantomJS for each test.
Step 4: Write a test that extends the scaffold

Comments

  1. Hats off to your presence of mind..I really enjoyed reading your blog. I really appreciate your information which you shared with us.

    software testing course in chennai

    ReplyDelete
  2. Yiioverflow presenting one of the best and high performance PHP framework. Fast, secure and extremely professionals are developing applications. We guide to implement mobile app development and SOA hybrid applications.Code in Nodejs, Angular,Ionic,ReactJS and Yiiframework.

    ReplyDelete
  3. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!
    Online training in USA

    ReplyDelete

Post a Comment

Popular posts from this blog

searchRecords with multiple criteria in Zoho CRM API

NB: this blog post is no longer relevant as API v2 lets you use searchRecords with multiple criteria :)

I discovered something really cool tucked away in the Zoho CRM forums today. For the history, check out this thread. In summary, the searchRecords API task in Zoho CRM is impossible to use if you have multiple criteria and in general it's pretty annoying to get the single criterion right. In the forum thread, Zoho Support advised that you can actually use getRecords with a view name. This feature is not documented on the getRecords page at all but I can confirm it works:D

This is really, really cool. It's going to make my life as a Zoho dev much easier! Instead of having to do something really inefficient and ugly like:
leadRecords = zoho.crm.searchRecords("Leads","(Created Time|<|" + yesterday_date +")",fromIndex,toIndex);for each ele in leadRecords{lead_source = ele.get("Lead Source");createTime=(ele.get("Created Time")).…

Round robin lead assignment for API generated leads in Zoho CRM

Do you add leads to your CRM via the Zoho CRM API? If so, you'll note that lead assignment rules don't work. I have developed a CRM extension called Advanced Round Robin that you can buy on the Zoho Marketplace. If you'd prefer to do it yourself, the below code can allow you to add round robin lead assignment functionality (though it's missing many of the more powerful features of the Advanced Round Robin extension). You'll need to set a few config variables like your authtoken and the user role you want leads to be assigned to. You'll also need to create a reference lead that's assigned to one of the users who should receive leads. The script will use this to figure out who should get the next lead. Thanks to Prakash from Zoho for giving me the base code for this script.


Want more options? I have a paid version of this script that you can buy on the Zoho Marketplace.

Performing mass updates on thousands of Zoho CRM records using custom functions

Need to mass update thousands of Lead records in Zoho CRM and can't be bothered manually clicking through tens of pages and doing mass update? Here's an example of using a custom function to achieve this. In this case, I needed to merge several notes fields into one text area field as the multiple note fields were becoming unwieldy.