Merge remote-tracking branch 'origin/master' into pr/105

This commit is contained in:
javier gomez 2015-10-31 09:51:58 +01:00
commit 7fb20c1630
9 changed files with 439 additions and 217 deletions

2
.gitignore vendored
View File

@ -45,6 +45,7 @@ vendor/*
# Robo
robo.phar
RoboFile.ini
# Test related files
tests/acceptance.suite.yml
@ -55,3 +56,4 @@ tests/_output*
selenium-server-standalone.jar
codecept.phar
selenium.log
tests/cache

View File

@ -2,23 +2,28 @@ language: php
php:
- 5.5
- 5.6
- 7.0
matrix:
allow_failures:
- php: 5.6
- php: 7.0
before_script:
- sudo apt-get update -qq
# Install Apache
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-intl php5-gd > /dev/null
- sudo /etc/init.d/apache2 stop
- sudo sed -i -e "s,APACHE_RUN_USER=www-data,APACHE_RUN_USER=$USER,g" /etc/apache2/envvars
- sudo sed -i -e "s,APACHE_RUN_GROUP=www-data,APACHE_RUN_GROUP=$USER,g" /etc/apache2/envvars
- sudo chown -R $USER /var/lock/apache2
- sudo chown -R $USER:$USER /var/www
- ln -s $TRAVIS_BUILD_DIR/tests/ /var/www/tests
- sudo sed -i -e "s,AllowOverride[ ]None,AllowOverride All,g" /etc/apache2/sites-available/default
- sudo /etc/init.d/apache2 start
- sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null
- sudo mkdir $(pwd)/.run
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php5-fpm.sock,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.owner = nobody,listen.owner = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.group = nobody,listen.group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,user = nobody,;user = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,group = nobody,;group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
- sudo cp -f tests/travis-ci-apache.conf /etc/apache2/sites-available/default
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
- git submodule update --init --recursive
- sudo service apache2 restart
# Xvfb
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
@ -27,8 +32,9 @@ before_script:
- sudo apt-get install fluxbox -y --force-yes
- fluxbox &
- sleep 3 # give fluxbox some time to start
# Composer
- composer install
script:
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
- vendor/bin/robo run:tests
- vendor/bin/robo run:tests true

View File

@ -5,6 +5,21 @@ This repo is meant to hold the decoupled com_weblinks component and related code
# Tests
To prepare the system tests (Selenium) to be run in your local machine you are asked to rename the file `tests/acceptance.suite.dist.yml` to `tests/acceptance.suite.yml`. Afterwards, please edit the file according to your system needs.
## Optional: extra configuration for RoboFile
This is not required, and if in doubt you can just skip this section, but there may be some specific use cases when you need (or want) to override the default behaviour of RoboFile.php. To do this, copy `RoboFile.dist.ini` to `RoboFile.ini` and add options in INI format, one per line, e.g.
skipClone = true
cmsPath = tests/joomla-cms3
The currently available options are as follows:
* `skipClone`: set to `true` to avoid the cms repo being deleted and re-cloned at each test execution. Useful to save time and bandwidth while you're debugging your test environment. But please be aware that if you don't refresh the repo you'll have to manually check the `installation` folder is present and the `configuration.php` is not.
* `cmsPath`: set to the local path (absolute or relative) where you'd like the test website to be installed. Default is `tests/joomla-cms3`.
* `branch`: set to whatever existing branch from the `joomla-cms` project if you want to clone that specific branch. Default is `staging`.
## Run the tests
To run the tests please execute the following commands (for the moment only working in Linux and MacOS, for more information see: https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception):
```bash
@ -13,25 +28,45 @@ $ vendor/bin/robo
$ vendor/bin/robo run:tests
```
##For Windows:
You need to install:
- Git for windows (https://msysgit.github.io/)
- GitHub for windows (https://windows.github.com/)
- Curl for windows if necesssary.
- Curl for Windows if necesssary.
Note: For commands line is better if you use the 'Git shell' program.
Create a symbolic link from your tests\joomla-cms3 to a subfolder of your web server. For example, I'm creating a link between the tests folder of my weblinks folder and the tests folder of my web server:
mklink /J C:\wamp\www\tests\joomla-cms3 C:\Users\Nicolas\Documents\GitHub\weblinks\tests\joomla-cms3
First you should create a fork of the official repository and clone the fork into your web server folder.
Go in the folder of weblinks, for example:
cd C:\Users\Nicolas\Documents\GitHub\weblinks
To prepare the system tests (Selenium) to be run in your local machine you are asked to rename the file `tests/acceptance.suite.dist.yml` to `tests/acceptance.suite.yml`. Afterwards, please edit the file according to your system needs.
Then, run the command:
composer install
The next step is only required if you don't place the weblinks folder into your web server folder. Create a symbolic link from your tests\joomla-cms3 to a subfolder of your web server. For example:
That will add all the dependencies for the testing of weblinks
You can then run the command:
vendor\bin\robo.bat test:acceptance
```bash
mklink /J C:\wamp\www\tests\joomla-cms3 C:\Users\Name\Documents\GitHub\weblinks\tests\joomla-cms3
```
Open the console and go in the folder of weblinks, for example:
```bash
cd C:\wamp\www\weblinks
```
Then run the command:
```bash
$ composer install
```
You can then run the following command to start the tests:
```bash
$ vendor/bin/robo run:tests
```
Once all tests were executed, you may also run a specific test:
```bash
$ vendor/bin/robo run:test // Then select the test you want to run!
```

10
RoboFile.dist.ini Normal file
View File

@ -0,0 +1,10 @@
; If set to true, the repo will not be cloned from GitHub and the local copy will be reused.
; This setting will be obsolete once we have local Git cache enabled
skipClone = false
; If you want to setup your test website in a different folder, you can do that here.
; You can also set an absolute path, i.e. /path/to/my/cms/folder
cmsPath = tests/joomla-cms3
; If you want to clone a different branch, you can set it here
branch = staging

View File

@ -17,6 +17,10 @@ class RoboFile extends \Robo\Tasks
private $extension = '';
private $configuration = array();
private $cmsPath = '';
/**
* Set the Execute extension for Windows Operating System
*
@ -24,7 +28,7 @@ class RoboFile extends \Robo\Tasks
*/
private function setExecExtension()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
if ($this->isWindows())
{
$this->extension = '.exe';
}
@ -33,16 +37,19 @@ class RoboFile extends \Robo\Tasks
/**
* Executes all the Selenium System Tests in a suite on your machine
*
* @param string $seleniumPath Optional path to selenium-standalone-server-x.jar
* @param string $suite Optional, the name of the tests suite
* @param bool $use_htaccess Renames and enable embedded Joomla .htaccess file
*
* @return mixed
*/
public function runTests($seleniumPath = null, $suite = 'acceptance')
public function runTests($use_htaccess = false)
{
$this->configuration = $this->getConfiguration();
$this->cmsPath = $this->getCmsPath();
$this->setExecExtension();
$this->createTestingSite();
$this->createTestingSite($use_htaccess);
$this->getComposer();
@ -50,7 +57,8 @@ class RoboFile extends \Robo\Tasks
$this->runSelenium();
$this->_exec('php' . $this->extension . ' vendor/bin/codecept build');
// Make sure to run the build command to generate AcceptanceTester
$this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build');
$this->taskCodecept()
->arg('--steps')
@ -75,10 +83,6 @@ class RoboFile extends \Robo\Tasks
->arg('tests/acceptance/frontend/')
->run()
->stopOnFail();
// Kill selenium server
// $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
/*
// Uncomment this lines if you need to debug selenium errors
$seleniumErrors = file_get_contents('selenium.log');
@ -104,8 +108,8 @@ class RoboFile extends \Robo\Tasks
{
$this->runSelenium();
// Make sure to Run the Build Command to Generate AcceptanceTester
$this->_exec("php vendor/bin/codecept build");
// Make sure to run the build command to generate AcceptanceTester
$this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build');
if (!$pathToTestFile)
{
@ -150,24 +154,111 @@ class RoboFile extends \Robo\Tasks
->arg('--debug')
->run()
->stopOnFail();
// Kill selenium server
// $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
}
/**
* Creates a testing Joomla site for running the tests (use it before run:test)
*
* @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
*/
public function createTestingSite()
public function createTestingSite($use_htaccess = false)
{
// Get Joomla Clean Testing sites
if (is_dir('tests/joomla-cms3'))
if (!empty($this->configuration->skipClone))
{
$this->taskDeleteDir('tests/joomla-cms3')->run();
$this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath);
return;
}
$this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3');
$this->say('Joomla CMS site created at tests/joomla-cms3');
// Caching cloned installations locally
if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24))
{
$this->_exec($this->buildGitCloneCommand());
}
// Get Joomla Clean Testing sites
if (is_dir($this->cmsPath))
{
$this->taskDeleteDir($this->cmsPath)->run();
}
$this->_copyDir('tests/cache', $this->cmsPath);
$this->say('Joomla CMS site created at ' . $this->cmsPath);
// Optionally uses Joomla default htaccess file. Used by TravisCI
if ($use_htaccess == true)
{
$this->_copy('/tests/joomla-cms3/htaccess.txt', 'tests/joomla-cms3/.htaccess');
$this->_exec('sed -e "s,# RewriteBase /,RewriteBase /tests/joomla-cms3/,g" --in-place tests/joomla-cms3/.htaccess');
}
}
/**
* Get (optional) configuration from an external file
*
* @return \stdClass|null
*/
public function getConfiguration()
{
$configurationFile = __DIR__ . '/RoboFile.ini';
if (!file_exists($configurationFile))
{
$this->say("No local configuration file");
return null;
}
$configuration = parse_ini_file($configurationFile);
if ($configuration === false)
{
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
return null;
}
return json_decode(json_encode($configuration));
}
/**
* Build correct git clone command according to local configuration and OS
*
* @return string
*/
private function buildGitCloneCommand()
{
$branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch;
$insecure = $this->isWindows() ? ' --insecure' : '';
return "git" . $this->extension . " clone -b $branch $insecure --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache";
}
/**
* Check if local OS is Windows
*
* @return bool
*/
private function isWindows()
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}
/**
* Get the correct CMS root path
*
* @return string
*/
private function getCmsPath()
{
if (empty($this->configuration->cmsPath))
{
return 'tests/joomla-cms3';
}
if (!file_exists(dirname($this->configuration->cmsPath)))
{
$this->say("Cms path written in local configuration does not exists or is not readable");
return 'tests/joomla-cms3';
}
return $this->configuration->cmsPath;
}
/**
@ -211,4 +302,16 @@ class RoboFile extends \Robo\Tasks
$this->_exec('curl --retry 3 --retry-delay 5 -sS https://getcomposer.org/installer | php');
}
}
/**
* Kills the selenium server running
*
* @param string $host Web host of the remote server.
* @param string $port Server port.
*/
public function killSelenium($host = 'localhost', $port = '4444')
{
$this->say('Trying to kill the selenium server.');
$this->_exec("curl http://$host:$port/selenium-server/driver/?cmd=shutDownSeleniumServer");
}
}

201
composer.lock generated
View File

@ -90,16 +90,16 @@
},
{
"name": "codegyre/robo",
"version": "0.5.4",
"version": "0.6.0",
"source": {
"type": "git",
"url": "https://github.com/Codegyre/Robo.git",
"reference": "10aa223f6d1db182dc81d723bf1545dfc6ff380d"
"reference": "d18185f0494c854d36aa5ee0ad931ee23bbef552"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Codegyre/Robo/zipball/10aa223f6d1db182dc81d723bf1545dfc6ff380d",
"reference": "10aa223f6d1db182dc81d723bf1545dfc6ff380d",
"url": "https://api.github.com/repos/Codegyre/Robo/zipball/d18185f0494c854d36aa5ee0ad931ee23bbef552",
"reference": "d18185f0494c854d36aa5ee0ad931ee23bbef552",
"shasum": ""
},
"require": {
@ -113,6 +113,7 @@
"require-dev": {
"codeception/aspect-mock": "0.5.*",
"codeception/base": "~2.1",
"codeception/codeception": "2.1",
"codeception/verify": "0.2.*",
"natxet/cssmin": "~3.0",
"patchwork/jsqueeze": "~1.0"
@ -137,7 +138,7 @@
}
],
"description": "Modern task runner",
"time": "2015-08-31 17:35:30"
"time": "2015-10-30 11:29:52"
},
{
"name": "doctrine/instantiator",
@ -352,16 +353,16 @@
},
{
"name": "guzzlehttp/promises",
"version": "1.0.2",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "97fe7210def29451ec74923b27e552238defd75a"
"reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/97fe7210def29451ec74923b27e552238defd75a",
"reference": "97fe7210def29451ec74923b27e552238defd75a",
"url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
"reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
"shasum": ""
},
"require": {
@ -399,7 +400,7 @@
"keywords": [
"promise"
],
"time": "2015-08-15 19:37:21"
"time": "2015-10-15 22:28:00"
},
{
"name": "guzzlehttp/psr7",
@ -464,12 +465,12 @@
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/henrikbjorn/Lurker.git",
"url": "https://github.com/flint/Lurker.git",
"reference": "a020d45b3bc37810aeafe27343c51af8a74c9419"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/henrikbjorn/Lurker/zipball/a020d45b3bc37810aeafe27343c51af8a74c9419",
"url": "https://api.github.com/repos/flint/Lurker/zipball/a020d45b3bc37810aeafe27343c51af8a74c9419",
"reference": "a020d45b3bc37810aeafe27343c51af8a74c9419",
"shasum": ""
},
@ -498,18 +499,16 @@
],
"authors": [
{
"name": "Henrik Bjornskov",
"email": "henrik@bjrnskov.dk",
"homepage": "http://henrik.bjrnskov.dk"
"name": "Yaroslav Kiliba",
"email": "om.dattaya@gmail.com"
},
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
"email": "ever.zet@gmail.com"
},
{
"name": "Yaroslav Kiliba",
"email": "om.dattaya@gmail.com"
"name": "Henrik Bjrnskov",
"email": "henrik@bjrnskov.dk"
}
],
"description": "Resource Watcher.",
@ -526,12 +525,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-projects/joomla-browser.git",
"reference": "3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa"
"reference": "0999fe673c34fbcf252957b6bc96bbf48956d70e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa",
"reference": "3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa",
"url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/0999fe673c34fbcf252957b6bc96bbf48956d70e",
"reference": "0999fe673c34fbcf252957b6bc96bbf48956d70e",
"shasum": ""
},
"require": {
@ -569,7 +568,7 @@
"acceptance testing",
"joomla"
],
"time": "2015-10-07 10:06:16"
"time": "2015-10-30 13:37:14"
},
{
"name": "joomla-projects/robo",
@ -759,16 +758,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "2.2.3",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f"
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f",
"reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"shasum": ""
},
"require": {
@ -817,7 +816,7 @@
"testing",
"xunit"
],
"time": "2015-09-14 06:51:16"
"time": "2015-10-06 15:47:00"
},
{
"name": "phpunit/php-file-iterator",
@ -999,16 +998,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.10",
"version": "4.8.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "463163747474815c5ccd4ae12b5b355ec12158e8"
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8",
"reference": "463163747474815c5ccd4ae12b5b355ec12158e8",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e",
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e",
"shasum": ""
},
"require": {
@ -1067,7 +1066,7 @@
"testing",
"xunit"
],
"time": "2015-10-01 09:14:30"
"time": "2015-10-23 06:48:33"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -1408,16 +1407,16 @@
},
{
"name": "sebastian/global-state",
"version": "1.0.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
@ -1455,7 +1454,7 @@
"keywords": [
"global state"
],
"time": "2014-10-06 09:23:50"
"time": "2015-10-12 03:26:01"
},
{
"name": "sebastian/recursion-context",
@ -1622,16 +1621,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4"
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"shasum": ""
},
"require": {
@ -1640,8 +1639,7 @@
},
"require-dev": {
"symfony/css-selector": "~2.0,>=2.0.5",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.0,>=2.0.5"
"symfony/process": "~2.3.34|~2.7,>=2.7.6"
},
"suggest": {
"symfony/process": ""
@ -1673,29 +1671,26 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2015-09-06 08:36:38"
"time": "2015-10-23 14:47:27"
},
{
"name": "symfony/config",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61"
"reference": "831f88908b51b9ce945f5e6f402931d1ac544423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61",
"reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61",
"url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423",
"reference": "831f88908b51b9ce945f5e6f402931d1ac544423",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/filesystem": "~2.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -1723,20 +1718,20 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2015-09-21 15:02:29"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/console",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161"
"reference": "5efd632294c8320ea52492db22292ff853a43766"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161",
"reference": "06cb17c013a82f94a3d840682b49425cd00a2161",
"url": "https://api.github.com/repos/symfony/console/zipball/5efd632294c8320ea52492db22292ff853a43766",
"reference": "5efd632294c8320ea52492db22292ff853a43766",
"shasum": ""
},
"require": {
@ -1745,7 +1740,6 @@
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.1"
},
"suggest": {
@ -1780,28 +1774,25 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-09-25 08:32:23"
"time": "2015-10-20 14:38:46"
},
{
"name": "symfony/css-selector",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "abe19cc0429a06be0c133056d1f9859854860970"
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/abe19cc0429a06be0c133056d1f9859854860970",
"reference": "abe19cc0429a06be0c133056d1f9859854860970",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -1833,28 +1824,27 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/dom-crawler",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "2e185ca136399f902b948694987e62c80099c052"
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2e185ca136399f902b948694987e62c80099c052",
"reference": "2e185ca136399f902b948694987e62c80099c052",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612",
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/css-selector": "~2.3",
"symfony/phpunit-bridge": "~2.7"
"symfony/css-selector": "~2.3"
},
"suggest": {
"symfony/css-selector": ""
@ -1886,20 +1876,20 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2015-09-20 21:13:58"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9"
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"shasum": ""
},
"require": {
@ -1910,7 +1900,6 @@
"symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6",
"symfony/phpunit-bridge": "~2.7",
"symfony/stopwatch": "~2.3"
},
"suggest": {
@ -1944,28 +1933,25 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/filesystem",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab"
"reference": "56fd6df73be859323ff97418d97edc1d756df6df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df",
"reference": "56fd6df73be859323ff97418d97edc1d756df6df",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -1993,28 +1979,25 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2015-09-09 17:42:36"
"time": "2015-10-18 20:23:18"
},
{
"name": "symfony/finder",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "8262ab605973afbb3ef74b945daabf086f58366f"
"reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8262ab605973afbb3ef74b945daabf086f58366f",
"reference": "8262ab605973afbb3ef74b945daabf086f58366f",
"url": "https://api.github.com/repos/symfony/finder/zipball/2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
"reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -2042,28 +2025,25 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2015-09-19 19:59:23"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/process",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9"
"reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b27c8e317922cd3cdd3600850273cf6b82b2e8e9",
"reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9",
"url": "https://api.github.com/repos/symfony/process/zipball/4a959dd4e19c2c5d7512689413921e0a74386ec7",
"reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -2091,28 +2071,25 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2015-09-19 19:59:23"
"time": "2015-10-23 14:47:27"
},
{
"name": "symfony/yaml",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770"
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -2140,7 +2117,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-09-14 14:14:09"
"time": "2015-10-11 09:39:48"
}
],
"aliases": [],

View File

@ -0,0 +1,85 @@
<?php
/**
* Class category
*
* Step Object to interact with a category
*
* @todo: this class should grow until being able to execute generic operations over a category: change status, add to category...
*
* @package Step\Acceptance
* @see http://codeception.com/docs/06-ReusingTestCode#StepObjects
*/
namespace Step\Acceptance;
/**
* Class AdministratorCategoriesStep
*
* @package AcceptanceTester
*
* @since 1.4
*/
class category extends \AcceptanceTester
{
/**
* Function to create a Category in Joomla!
*
* @param String $categoryName Name of the Category which is to be created
*
* @return void
*/
public function createCategory($categoryName)
{
$I = $this;
$I->am('Administrator');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('try to save a category with a filled title');
$I->clickToolbarButton('New');
$I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], $categoryName);
$I->clickToolbarButton('Save & Close');
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
}
/**
* Function to Trash a Category in Joomla!
*
* @param String $categoryName Name of the category which is to be trashed
*
* @return void
*/
public function trashCategory($categoryName)
{
$I = $this;
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->searchForItem($categoryName);
$I->amGoingTo('Select the weblink result');
$I->checkAllResults();
$I->clickToolbarButton("Trash");
$I->see('category successfully trashed.', ['id' => 'system-message-container']);
}
/**
* Function to Delete a Category in Joomla!
*
* @param String $categoryName Name of the category which is to be deleted
*
* @return void
*/
public function deleteCategory($categoryName)
{
$I = $this;
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->setFilter('select status', 'Trashed');
$I->searchForItem($categoryName);
$I->amGoingTo('Select the weblink result');
$I->checkAllResults();
$I->clickToolbarButton("empty trash");
$I->see('category successfully deleted.', ['id' => 'system-message-container']);
}
}

View File

@ -9,26 +9,19 @@
*/
class AdministratorCategoriesCest
{
public function administratorCreateCategory(AcceptanceTester $I)
public function administratorCreateCategory(\Step\Acceptance\category $I)
{
$I->am('Administrator');
$categoryName = 'automated testing' . rand(1, 100);
$I->wantToTest('Category creation in /administrator/');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('try to save a category with a filled title');
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]);
$I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], 'automated testing' . rand(1, 100));
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.apply')\"]"]);
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
$I->amGoingTo('Navigate to Categories page in /administrator/ and create a Category');
$I->createCategory($categoryName);
$I->amGoingTo('Delete the Category which was created');
$I->trashCategory($categoryName);
$I->deleteCategory($categoryName);
}
public function administratorCreateCategoryWithoutTitleFails(AcceptanceTester $I)
@ -51,87 +44,72 @@ class AdministratorCategoriesCest
$I->see('Invalid field: Title', ['id' => 'system-message-container']);
}
public function administratorPublishCategory(AcceptanceTester $I)
public function administratorPublishCategory(\Step\Acceptance\category $I)
{
$I->am('Administrator');
$I->wantToTest('Category publishing in /administrator/');
$categoryName = 'automated testing pub' . rand(1, 100);
$I->wantToTest('Category creation in /administrator/');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('Navigate to Categories page in /administrator/ and create a new Category');
$I->createCategory($categoryName);
$I->amGoingTo('try to save a category with a filled title');
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]);
$I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], 'automated testing pub' . rand(1, 100));
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]);
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
$I->amGoingTo('Search for automated testing');
$I->fillField(['xpath' => "//input[@id=\"filter_search\"]"], "automated testing pub" . "\n");
$I->searchForItem($categoryName);
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath' => "//input[@id=\"cb0\"]"]);
$I->checkAllResults();
$I->amGoingTo('try to publish a weblink category');
$I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.publish')}\"]"]);
$I->clickToolbarButton('publish');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('see a success message after publishing the category');
$I->see('1 category successfully published.', ['id' => 'system-message-container']);
$I->amGoingTo('Delete the Category which was created');
$I->trashCategory($categoryName);
$I->deleteCategory($categoryName);
}
public function administratorUnpublishCategory(AcceptanceTester $I)
public function administratorUnpublishCategory(\Step\Acceptance\category $I)
{
$I->am('Administrator');
$I->wantToTest('Category unpublishing in /administrator/');
$categoryName = 'automated testing unpub' . rand(1, 100);
$I->wantToTest('Category creation in /administrator/');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings();
$I->createCategory($categoryName);
$I->amGoingTo('try to save a category with a filled title');
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]);
$I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], 'automated testing unpub' . rand(1, 100));
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]);
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
$I->amGoingTo('Search for automated testing');
$I->fillField(['xpath' => "//input[@id=\"filter_search\"]"], "automated testing unpub" . "\n");
$I->searchForItem($categoryName);
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath' => "//input[@id=\"cb0\"]"]);
$I->checkAllResults();
$I->amGoingTo('Try to publish a weblink category');
$I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.publish')}\"]"]);
//publish the category
$I->amGoingTo('try to publish a weblink category');
$I->clickToolbarButton('publish');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('See a success message after publishing the category');
$I->expectTo('see a success message after publishing the category');
$I->see('1 category successfully published.', ['id' => 'system-message-container']);
// Unpublish it again
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath' => "//input[@id=\"cb0\"]"]);
$I->checkAllResults();
$I->amGoingTo('Try to unpublish a weblink category');
$I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.unpublish')}\"]"]);
$I->clickToolbarButton('unpublish');
$I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']);
$I->expectTo('See a success message after unpublishing the category');
$I->see('1 category successfully unpublished', ['id' => 'system-message-container']);
//delete the category
$I->amGoingTo('Delete the Category which was created');
$I->trashCategory($categoryName);
$I->deleteCategory($categoryName);
}
public function administratorArchiveCategory(\Step\Acceptance\category $I)
{

View File

@ -0,0 +1,26 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot %TRAVIS_BUILD_DIR%
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization
</IfModule>
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>