From 3e268d0626fa5d4300c7c5122fd1e6fc2859c417 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 14:52:04 +0100 Subject: [PATCH 1/3] Add config param for local cms folder --- RoboFile.dist.ini | 3 ++- RoboFile.php | 33 ++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 2980766..8d3a728 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1 +1,2 @@ -skipClone = true \ No newline at end of file +skipClone = true +cmsPath = /path/to/my/local/website/root \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index a104e85..216acce 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -19,6 +19,8 @@ class RoboFile extends \Robo\Tasks private $configuration = array(); + private $cmsPath = ''; + /** * Set the Execute extension for Windows Operating System * @@ -44,6 +46,8 @@ class RoboFile extends \Robo\Tasks { $this->configuration = $this->getConfiguration(); + $this->cmsPath = $this->getCmsPath(); + $this->setExecExtension(); $this->createTestingSite(); @@ -165,18 +169,18 @@ class RoboFile extends \Robo\Tasks public function createTestingSite() { if (!empty($this->configuration->skipClone)) { - $this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); + $this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath); return; } // Get Joomla Clean Testing sites - if (is_dir('tests/joomla-cms3')) + if (is_dir($this->cmsPath)) { - $this->taskDeleteDir('tests/joomla-cms3')->run(); + $this->taskDeleteDir($this->cmsPath)->run(); } - $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'); + $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git ' . $this->cmsPath); + $this->say('Joomla CMS site created at ' . $this->cmsPath); } /** @@ -202,6 +206,25 @@ class RoboFile extends \Robo\Tasks return json_decode(json_encode($configuration)); } + /** + * 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; + } + /** * Runs Selenium Standalone Server. * From 08c2f8b641b2ebad62ee51390fe8f8f77c0fc48e Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 16:06:04 +0100 Subject: [PATCH 2/3] Improve dist.ini file and fix CS --- RoboFile.dist.ini | 8 ++++++-- RoboFile.php | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 8d3a728..615510f 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1,2 +1,6 @@ -skipClone = true -cmsPath = /path/to/my/local/website/root \ No newline at end of file +; 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 \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 216acce..48e8daf 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -168,7 +168,8 @@ class RoboFile extends \Robo\Tasks */ public function createTestingSite() { - if (!empty($this->configuration->skipClone)) { + if (!empty($this->configuration->skipClone)) + { $this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath); return; } @@ -192,13 +193,15 @@ class RoboFile extends \Robo\Tasks { $configurationFile = __DIR__ . '/RoboFile.ini'; - if (!file_exists($configurationFile)) { + if (!file_exists($configurationFile)) + { $this->say("No local configuration file"); return null; } $configuration = parse_ini_file($configurationFile); - if ($configuration === false) { + if ($configuration === false) + { $this->say('Local configuration file is empty or wrong (check is it in correct .ini format'); return null; } @@ -213,11 +216,13 @@ class RoboFile extends \Robo\Tasks */ private function getCmsPath() { - if (empty($this->configuration->cmsPath)) { + if (empty($this->configuration->cmsPath)) + { return 'tests/joomla-cms3'; } - if (!file_exists(dirname($this->configuration->cmsPath))) { + 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'; } From d42948bd4895e3a804b2b6f7a650b9bd282a266c Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Thu, 29 Oct 2015 15:17:53 +0530 Subject: [PATCH 3/3] Adding Test for Deleting Category Fixes #103 --- composer.lock | 190 ++++++++---------- tests/_support/Step/Acceptance/category.php | 65 ++++++ .../AdministratorCategoriesCest.php | 95 ++++----- 3 files changed, 183 insertions(+), 167 deletions(-) create mode 100644 tests/_support/Step/Acceptance/category.php diff --git a/composer.lock b/composer.lock index 230610c..f444dc6 100644 --- a/composer.lock +++ b/composer.lock @@ -352,16 +352,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 +399,7 @@ "keywords": [ "promise" ], - "time": "2015-08-15 19:37:21" + "time": "2015-10-15 22:28:00" }, { "name": "guzzlehttp/psr7", @@ -464,12 +464,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 +498,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 +524,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa" + "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9" }, "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/0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", + "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", "shasum": "" }, "require": { @@ -569,7 +567,7 @@ "acceptance testing", "joomla" ], - "time": "2015-10-07 10:06:16" + "time": "2015-10-29 14:44:24" }, { "name": "joomla-projects/robo", @@ -759,16 +757,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 +815,7 @@ "testing", "xunit" ], - "time": "2015-09-14 06:51:16" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", @@ -999,16 +997,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 +1065,7 @@ "testing", "xunit" ], - "time": "2015-10-01 09:14:30" + "time": "2015-10-23 06:48:33" }, { "name": "phpunit/phpunit-mock-objects", @@ -1408,16 +1406,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 +1453,7 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", @@ -1622,16 +1620,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 +1638,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 +1670,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 +1717,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 +1739,6 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { @@ -1780,28 +1773,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 +1823,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 +1875,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 +1899,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 +1932,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 +1978,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 +2024,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 +2070,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 +2116,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-09-14 14:14:09" + "time": "2015-10-11 09:39:48" } ], "aliases": [], diff --git a/tests/_support/Step/Acceptance/category.php b/tests/_support/Step/Acceptance/category.php new file mode 100644 index 0000000..2e7c44d --- /dev/null +++ b/tests/_support/Step/Acceptance/category.php @@ -0,0 +1,65 @@ +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 Delete a Category in Joomla! + * + * @param String $categoryName Name of the category which is to be deleted + * + * @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']); + } +} diff --git a/tests/acceptance/administrator/AdministratorCategoriesCest.php b/tests/acceptance/administrator/AdministratorCategoriesCest.php index 5518e73..6bd8b7f 100644 --- a/tests/acceptance/administrator/AdministratorCategoriesCest.php +++ b/tests/acceptance/administrator/AdministratorCategoriesCest.php @@ -9,26 +9,18 @@ */ 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); } public function administratorCreateCategoryWithoutTitleFails(AcceptanceTester $I) @@ -51,86 +43,69 @@ 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); } - 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); } } \ No newline at end of file