Skip to content

Commit

Permalink
Fixed travis-ci builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkms committed Nov 2, 2014
1 parent ad73e60 commit 2462b54
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 248 deletions.
2 changes: 1 addition & 1 deletion .ci/common_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

SELENIUM_HUB_URL='http://127.0.0.1:4444'
SELENIUM_JAR=/usr/share/selenium/selenium-server-standalone.jar
SELENIUM_DOWNLOAD_URL=http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.1.jar
SELENIUM_DOWNLOAD_URL=http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar
PHP_VERSION=$(php -v)
5 changes: 0 additions & 5 deletions .ci/phpunit-environment.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ autostart=false ; selenium
command=python -m SimpleHTTPServer 8080
directory=. ; python-webserver
autostart=false ; python-webserver

[program:php-webserver]
command=php -S localhost:8080
directory=. ; php-webserver
autostart=false ; php-webserver
11 changes: 4 additions & 7 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

sudo apt-get update

if [ ! -f "/usr/local/bin/composer" ]; then
echo "Installing Composer"
php -r "readfile('https://getcomposer.org/installer');" | sudo php -d apc.enable_cli=0 -- --install-dir=/usr/local/bin --filename=composer
Expand All @@ -8,7 +10,7 @@ else
sudo /usr/local/bin/composer self-update
fi

if [ ! -d vendor ] || [ ! -f vendor/autoload.php ]; then
if [ ! -d vendor ] || [ ! -f vendor/autoload.php ]; then
echo "Installing dependencies"
composer install --dev
fi
Expand All @@ -18,12 +20,7 @@ sudo apt-get install supervisor -y --no-install-recommends
sudo cp ./.ci/phpunit-environment.conf /etc/supervisor/conf.d/
sudo sed -i "s/^directory=.*webserver$/directory=${ESCAPED_BUILD_DIR}\\/selenium-1-tests/" /etc/supervisor/conf.d/phpunit-environment.conf
sudo sed -i "s/^autostart=.*selenium$/autostart=true/" /etc/supervisor/conf.d/phpunit-environment.conf

if $(echo "$PHP_VERSION" | grep --quiet 'PHP 5.4'); then
sudo sed -i "s/^autostart=.*php-webserver$/autostart=true/" /etc/supervisor/conf.d/phpunit-environment.conf
else
sudo sed -i "s/^autostart=.*python-webserver$/autostart=true/" /etc/supervisor/conf.d/phpunit-environment.conf
fi
sudo sed -i "s/^autostart=.*python-webserver$/autostart=true/" /etc/supervisor/conf.d/phpunit-environment.conf

echo "Installing Firefox"
sudo apt-get install firefox -y --no-install-recommends
Expand Down
2 changes: 1 addition & 1 deletion .ci/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

sudo supervisorctl reload

wget --retry-connrefused --tries=60 --waitretry=1 --output-file=/dev/null "$SELENIUM_HUB_URL/wd/hub/status" -O /dev/null
wget --retry-connrefused --tries=120 --waitretry=3 --output-file=/dev/null "$SELENIUM_HUB_URL/wd/hub/status" -O /dev/null
if [ ! $? -eq 0 ]; then
echo "Selenium Server not started"
else
Expand Down
2 changes: 0 additions & 2 deletions .ci/vagrant_pre_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restr
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse" /etc/apt/sources.list
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" /etc/apt/sources.list

apt-get update

# installing xvfb, java and php
apt-get install xvfb openjdk-7-jre-headless php5-cli php5-curl php5-xdebug ncurses-term -y --no-install-recommends
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ firefox/
/.buildpath
/.settings
/.vagrant/
/.idea
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ php:
- 5.5
- 5.6
- hhvm

matrix:
allow_failures:
- php: hhvm

before_script: ./.ci/before_script.sh
script: "vendor/bin/phpunit --verbose --debug Tests"
script: "vendor/bin/phpunit Tests"
2 changes: 1 addition & 1 deletion Tests/Selenium2TestCase/ScreenshotListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testStoresAScreenshotInCaseOfFailure()
{
$this->url('html/test_open.html');

$exception = $this->getMock('PHPUnit_Framework_AssertionFailedError');
$exception = new PHPUnit_Framework_AssertionFailedError();
$this->listener->addFailure($this, $exception, NULL);

$this->assertThereIsAScreenshotNamed('Tests_Selenium2TestCase_ScreenshotListenerTest__testStoresAScreenshotInCaseOfFailure*.png');
Expand Down
26 changes: 2 additions & 24 deletions Tests/Selenium2TestCase/SuiteBuildingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,17 @@ class Extensions_Selenium2SuiteBuildingTest extends PHPUnit_Framework_TestCase
{
public function testSampleTestCaseBuildsAFullSuiteContainingAllItsTests()
{
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
$suite = Extensions_Selenium2TestCaseSample::suite('Extensions_Selenium2TestCaseSample');
$this->assertInstanceOf('PHPUnit_Framework_TestSuite', $suite);
$this->assertEquals(2, count($suite->tests()));
}

public function testAMultipleBrowsersTestCaseBuildsACopyOfEachTestForEachBrowser()
{
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
$suite = Extensions_Selenium2MultipleBrowsersTestCaseSample::suite('Extensions_Selenium2MultipleBrowsersTestCaseSample');
$this->assertInstanceOf('PHPUnit_Framework_TestSuite', $suite);
$this->assertEquals(2, count($suite->tests()));
}
}

class Extensions_Selenium2TestCaseSample extends PHPUnit_Extensions_Selenium2TestCase
{
public function testFirst() {}
public function testSecond() {}
}

class Extensions_Selenium2MultipleBrowsersTestCaseSample extends PHPUnit_Extensions_Selenium2TestCase
{
public static $browsers = array(
array(
'browserName' => 'firefox',
'host' => 'localhost',
'port' => 4444,
),
array(
'browserName' => 'safari',
'host' => 'localhost',
'port' => 4444,
),
);

public function testSingle() {}
}
25 changes: 25 additions & 0 deletions Tests/Selenium2TestCase/fixtures/SuiteBuildingSuites.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

class Extensions_Selenium2TestCaseSample extends PHPUnit_Extensions_Selenium2TestCase
{
public function testFirst() {}
public function testSecond() {}
}

class Extensions_Selenium2MultipleBrowsersTestCaseSample extends PHPUnit_Extensions_Selenium2TestCase
{
public static $browsers = array(
array(
'browserName' => 'firefox',
'host' => 'localhost',
'port' => 4444,
),
array(
'browserName' => 'safari',
'host' => 'localhost',
'port' => 4444,
),
);

public function testSingle() {}
}
30 changes: 2 additions & 28 deletions Tests/SeleniumTestCase/SuiteBuildingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,43 +56,17 @@ class Extensions_SeleniumSuiteBuildingTest extends PHPUnit_Framework_TestCase
{
public function testSampleTestCaseBuildsAFullSuiteContainingAllItsTests()
{
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
$suite = Extensions_SeleniumTestCaseSample::suite('Extensions_SeleniumTestCaseSample');
$this->assertInstanceOf('PHPUnit_Framework_TestSuite', $suite);
$this->assertEquals(2, count($suite->tests()));
}

public function testAMultipleBrowsersTestCaseBuildsACopyOfEachTestForEachBrowser()
{
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
$suite = Extensions_SeleniumMultipleBrowsersTestCaseSample::suite('Extensions_SeleniumMultipleBrowsersTestCaseSample');
$this->assertInstanceOf('PHPUnit_Framework_TestSuite', $suite);
$this->assertEquals(2, count($suite->tests()));
}
}

class Extensions_SeleniumTestCaseSample extends PHPUnit_Extensions_SeleniumTestCase
{
public function testFirst() {}
public function testSecond() {}
}

class Extensions_SeleniumMultipleBrowsersTestCaseSample extends PHPUnit_Extensions_SeleniumTestCase
{
public static $browsers = array(
array(
'name' => 'Firefox on Linux',
'browser' => '*firefox',
'host' => 'localhost',
'port' => 4444,
'timeout' => 30000,
),
array(
'name' => 'Safari on MacOS X',
'browser' => '*safari',
'host' => 'localhost',
'port' => 4444,
'timeout' => 30000,
),
);

public function testSingle() {}
}
29 changes: 29 additions & 0 deletions Tests/SeleniumTestCase/fixtures/SuiteBuildingSuites.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

class Extensions_SeleniumTestCaseSample extends PHPUnit_Extensions_SeleniumTestCase
{
public function testFirst() {}
public function testSecond() {}
}

class Extensions_SeleniumMultipleBrowsersTestCaseSample extends PHPUnit_Extensions_SeleniumTestCase
{
public static $browsers = array(
array(
'name' => 'Firefox on Linux',
'browser' => '*firefox',
'host' => 'localhost',
'port' => 4444,
'timeout' => 30000,
),
array(
'name' => 'Safari on MacOS X',
'browser' => '*safari',
'host' => 'localhost',
'port' => 4444,
'timeout' => 30000,
),
);

public function testSingle() {}
}
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source ./.ci/start.sh
SCRIPT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise32"
config.vm.box = "hashicorp/precise64"

config.vm.provision "shell", inline: $setupEnvironment
end
Loading

0 comments on commit 2462b54

Please sign in to comment.