Drone-CI |
---|
Weblinks for Joomla! provides a component and accompanying extensions to create a directory of weblinks.
With the Patch Tester Component
Easily apply changes from a pull requests against this repo:
Install the last release of com_weblinks into your Joomla.
Install the last release of com_patchtester into your Joomla (weblinks is supported since Version 3.0.0 Alpha 2).
Log into your site's administrator section, go to the Patch Tester Component Options (Components -> Patch Tester -> Options)
Switch the GitHub Repository
to Joomla Weblinks Package
. For this you have to fill the field GitHub Project Owner
with joomla-extensions
and the field GitHub Project Repository
with weblinks
.
Click Save & Close
and hit the Fetch Data
Button to the the lastest pull requests
Click Apply Patch
to apply the proposed changes from the pull request.
Click Revert Patch
to revert an applied patch.
You can read more about the Patch Tester extension on the Joomla! Documentation Wiki.
If you want to test a patch you can apply the patch via git.
If you cloned this repo under the name upstream - your remote is upstream – you can user the command
git fetch upstream pull/PR_NUMBER/head:BRANCHNUMER
for fetching the branch of the PR #290 this would be
git fetch upstream pull/290/head:move-lang-files
After that you can checkout the branch and start testing.
git checkout move-lang-files
$ cd /var/www/html/
/var/www/html$
/var/www/html$ git clone git@github.com:joomla-extensions/weblinks.git
Clone nach 'weblinks' ...
remote: Counting objects: 2446, done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 2446 (delta 10), reused 0 (delta 0), pack-reused 2361
Empfange Objekte: 100% (2446/2446), 615.02 KiB | 375.00 KiB/s, Fertig.
Löse Unterschiede auf: 100% (1232/1232), Fertig.
Prüfe Konnektivität ... Fertig.
Are you new with github? Here you can find informations about setting it up: https://help.github.com/articles/set-up-git/ If you get an error you can try git clone https://github.com:joomla-extensions/weblinks.git instead of git clone git@github.com:joomla-extensions/weblinks.git
/var/www/html$ cd weblinks
/var/www/html/weblinks$
/var/www/html/weblinks$ ls
codeception.yml docs LICENSE RoboFile.dist.ini tests
composer.json jed_update.xml manifest.xml RoboFile.php
composer.lock jorobo.dist.ini README.md src
5. Optional: Have a look into composer.json for information what software you will install via composer.
/var/www/html/weblinks$ cat composer.json
or https://github.com/joomla-extensions/weblinks/blob/master/composer.json
Read more about how to install composer here.
/var/www/html/weblinks$export COMPOSER_PROCESS_TIMEOUT=1500;
/var/www/html/weblinks$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing symfony/yaml (v3.1.3)
Downloading: 100%
...
...
Generating autoload files
8. After that you have to build robo
/var/www/html/weblinks$ vendor/bin/robo build
If you use MySQL or PostgreSQL as database and your user has create database privileges the Database is automatically created by the Joomla installer. But the safest way is to create the database before running Joomla's web installer.
/var/www/html/weblinks$ mysql -u root -p
mysql> create database weblinks;
Query OK, 1 row affected (0,00 sec)
mysql> quit;
Bye
/var/www/html/weblinks$ cd tests
/var/www/html/weblinks/tests$ cp acceptance.suite.dist.yml acceptance.suite.yml
11. Update the file acceptance.suite.yml to your needs. At least you have to update the options url, database name and counter_test_url.
/var/www/html/weblinks/tests$ cat acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- JoomlaBrowser
- AcceptanceHelper
config:
JoomlaBrowser:
url: 'http://localhost/weblinks/tests/joomla-cms3' # the url that points to the joomla installation at /tests/system/joomla-cms
browser: 'firefox'
window_size: 1024x768
capabilities:
unexpectedAlertBehaviour: 'accept'
username: 'admin' # UserName for the Administrator
password: 'admin' # Password for the Administrator
database host: 'localhost' # place where the Application is Hosted #server Address
database user: 'root' # MySQL Server user ID, usually root
database password: 'yourPassword' # MySQL Server password, usually empty or root
database name: 'weblinks' # DB Name, at the Server
database type: 'mysqli' # type in lowercase one of the options: MySQL\MySQLi\PDO
database prefix: 'jos_' # DB Prefix for tables
install sample data: 'no' # Do you want to Download the Sample Data Along with Joomla Installation, then keep it Yes
sample data: 'Default English (GB) Sample Data' # Default Sample Data
admin email: 'admin@mydomain.com' # email Id of the Admin
language: 'English (United Kingdom)' # Language in which you want the Application to be Installed
AcceptanceHelper:
repo_folder: '/home/travis/build/joomla-extensions/weblinks/' # Path to the Extension repository. To be used by tests to install via Install from folder
counter_test_url: 'http://localhost/weblinks/tests/joomla-cms3' # the url for the weblink item used to test hits counter
url: 'http://localhost/weblinks/tests/joomla-cms3' # the url that points to the joomla installation at /tests/system/joomla-cms - we need it twice here
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
env:
desktop: ~
tablet:
modules:
config:
JoomlaBrowser:
window_size: 768x1024
phone:
modules:
config:
JoomlaBrowser:
window_size: 480x640
12. Optional: Go back to weblinks directory and create and edit the file RoboFile.ini. Delete the local user www-data.
/var/www/html/weblinks$ cp RoboFile.dist.ini RoboFile.ini
/var/www/html/weblinks$ cat RoboFile.ini
; 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 = 3.10-dev
; (Linux / Mac only) If you want to set a different owner for the CMS root folder, you can set it here.
localUser =
; Set this to true, if your curl binaries are not able to create an https connection
insecure = false
/var/www/html/weblinks$sudo chown -R username:usergroup /var/www
/var/www/html/weblinks$ vendor/bin/robo run:tests
Clone nach 'tests/cache' ...
[Exec] Done in 13.18s
[FileSystem\CopyDir] Copied from tests/cache to tests/joomla-cms3
...
The tests in Weblinks Extension use Codeception Testing Framework, if you want to know more about the technology used for testing please check: Testing Joomla Extensions with Codeception.
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
The currently available options are as follows:
skipClone
: set totrue
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 theinstallation
folder is present and theconfiguration.php
is not.cmsPath
: set to the local path (absolute or relative) where you'd like the test website to be installed. Default istests/joomla-cms3
.branch
: set to whatever existing branch from thejoomla-cms
project if you want to clone that specific branch. Default is3.10-dev
.
You can run the tests against different resolutions. The default acceptance YAML configuration file provides three options:
- "desktop": default, 1024x768px
- "tablet": tablet in portrait mode, 768x1024px
- "phone": phone in portrait mode, 480x640px
To set a specific resolution, set is as an option of the command:
$ vendor/bin/robo run:tests --env=tablet
Note: the first parameter is used by Travis and you should always set it to "0" when you run your tests locally.
Here you can finde a video that shows the installation of com_weblinks for testing.
You need to install:
- Git for windows (https://msysgit.github.io/)
- GitHub for windows (https://windows.github.com/)
- Curl for Windows if necessary.
- for complete list of necessary software and tips check this wiki page
Note: For commands line is better if you use the 'Git shell' program.
First you should create a fork of the official repository and clone the fork into your web server folder.
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.
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:
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:
cd C:\wamp\www\weblinks
Then run the command:
$ composer install
You can then run the following command to start the tests:
$ vendor/bin/robo run:tests
Once all tests were executed, you may also run a specific test:
$ vendor/bin/robo run:test // Then select the test you want to run!