Posts tagged phpunit
PHPUnit – How to mock multiple calls to the same method0
When you write unit tests with PHPUnit there is a big chance that you have to mock several objects. If you want to write a unit test for your controller action and you use Doctrine ORM in your project, you will have to mock the Doctrine EntityManager, specific repositories and specify return values of the repository method calls. In the example below a repository method calls are “getCustomers” and “getNewHouse”.
The use of $this->at() (not possible)
Mocking multiple calls to the same method can be a bit difficult with PHPUnit. Because if you have More >
Ubuntu 14.04 – Install Selenium as service (headless)13
This tutorial will show you how to install Selenium as a service on a Ubuntu 14.04 server. An Ubuntu server doesn’t have a GUI in contrast to Ubuntu desktop, so we will also need to setup a virtual screen where firefox will run.
Perform all actions as root!
Selenium is a Java application, so make sure Java is installed. Installation instructions: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get.
Install Firefox and Xvfb.
apt-get update apt-get install firefox xvfb
Create a virtual screen a (re)boot.
Add the following line as first cronjob:
@reboot sh -c 'Xvfb :99 -ac -screen
Ubuntu Server 10.10/11.04 – Selenium Server (headless) & PHPUnit3
This tutorial explains how to run Selenium test cases with Selenium Server and PHPUnit on a Linux server that has no GUI (headless).
Make sure you have pear installed. Then upgrade to at least version 1.9.2
pear upgrade pear
apt-get install firefox
In order to run firefox on a headless server (means without a GUI), Xvfb (X virtual frame buffer) must be used. To install it:
apt-get install xvfb
apt-get install openjdk-6-jre-headless
Download Selenium Server and put it on your server, for example: /opt/selenium-server.jar. http://seleniumhq.org/download/ or direct link More >