32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-25 17:51:07 +00:00

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

# Conflicts:
#	tests/acceptance.suite.dist.yml
This commit is contained in:
javier gomez 2015-11-04 11:48:14 +01:00
commit 44be385447
89 changed files with 1930 additions and 214 deletions

5
.gitignore vendored
View File

@ -57,3 +57,8 @@ selenium-server-standalone.jar
codecept.phar
selenium.log
tests/cache
# Package building related
/dist
jbuild.ini

View File

@ -36,5 +36,8 @@ before_script:
- composer install
script:
# Build
- mv jbuild.dist.ini jbuild.ini
- vendor/bin/robo build
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
- vendor/bin/robo run:tests --use-htaccess

View File

@ -2,6 +2,13 @@
This repo is meant to hold the decoupled com_weblinks component and related code.
# Building
```bash
$ composer install
$ vendor/bin/robo build
```
# Tests
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](https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception).

View File

@ -10,10 +10,16 @@
require_once 'vendor/autoload.php';
if (!defined('JPATH_BASE'))
{
define('JPATH_BASE', __DIR__);
}
class RoboFile extends \Robo\Tasks
{
// Load tasks from composer, see composer.json
use \joomla_projects\robo\loadTasks;
use \JBuild\Tasks\loadTasks;
/**
* File extension for executables
@ -46,6 +52,9 @@ class RoboFile extends \Robo\Tasks
$this->cmsPath = $this->getCmsPath();
$this->executableExtension = $this->getExecutableExtension();
// Set default timezone (so no warnings are generated if it is not set)
date_default_timezone_set('UTC');
}
/**
@ -176,6 +185,45 @@ class RoboFile extends \Robo\Tasks
$pathToTestFile = 'tests/' . $suite . '/' . $test;
//loading the class to display the methods in the class
require 'tests/' . $suite . '/' . $test;
//logic to fetch the class name from the file name
$fileName = explode("/", $test);
$className = explode(".", $fileName[1]);
//if the selected file is cest only than we will give the option to execute individual methods, we don't need this in cept file
$i = 1;
if (strripos($className[0], 'cest'))
{
$class_methods = get_class_methods($className[0]);
$this->say('[' . $i . '] ' . 'All');
$methods[$i] = 'All';
$i++;
foreach ($class_methods as $method_name)
{
$reflect = new ReflectionMethod($className[0], $method_name);
if(!$reflect->isConstructor())
{
if ($reflect->isPublic())
{
$this->say('[' . $i . '] ' . $method_name);
$methods[$i] = $method_name;
$i++;
}
}
}
$this->say('');
$methodNumber = $this->ask('Please choose the method in the test that you would want to run...');
$method = $methods[$methodNumber];
}
if(isset($method) && $method != 'All')
{
$pathToTestFile = $pathToTestFile . ':' . $method;
}
$this->taskCodecept()
->test($pathToTestFile)
->arg('--steps')
@ -231,6 +279,11 @@ class RoboFile extends \Robo\Tasks
// Caching cloned installations locally
if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24))
{
if (file_exists('tests/cache'))
{
$this->taskDeleteDir('tests/cache')->run();
}
$this->_exec($this->buildGitCloneCommand());
}
@ -257,6 +310,14 @@ class RoboFile extends \Robo\Tasks
$this->_exec('chown -R ' . $this->configuration->localUser . ' ' . $this->cmsPath);
}
// Copy current package
if (!file_exists('dist/pkg-weblinks-current.zip'))
{
$this->build(true);
}
$this->_copy('dist/pkg-weblinks-current.zip', $this->cmsPath . "/pkg-weblinks-current.zip");
$this->say('Joomla CMS site created at ' . $this->cmsPath);
// Optionally uses Joomla default htaccess file. Used by TravisCI
@ -413,4 +474,21 @@ class RoboFile extends \Robo\Tasks
{
$this->_exec('phpcpd' . $this->extension . ' ' . __DIR__ . '/src');
}
/**
* Build the joomla extension package
*
* @param array $params Additional params
*
* @return void
*/
public function build($params = ['dev' => false])
{
if (!file_exists('jbuild.ini'))
{
$this->_copy('jbuild.dist.ini', 'jbuild.ini');
}
$this->taskBuild($params)->run();
}
}

View File

@ -11,6 +11,7 @@
"codegyre/robo": "~0.5",
"joomla-projects/robo": "dev-master",
"joomla-projects/selenium-server-standalone": "v2.47.1",
"fzaninotto/faker": "^1.5"
"fzaninotto/faker": "^1.5",
"joomla-projects/jorobo": "dev-master"
}
}

1645
composer.lock generated

File diff suppressed because it is too large Load Diff

5
docs/README.md Normal file
View File

@ -0,0 +1,5 @@
How to install
Just install the package file over the normal Joomla! installer
You can also only install certain parts by unzipping the package before.

4
jbuild.dist.ini Normal file
View File

@ -0,0 +1,4 @@
extension = weblinks
version = 3.4.3
source = src
target = package

View File

@ -2,12 +2,12 @@
<extension type="component" version="3.1" method="upgrade">
<name>com_weblinks</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2005 - 2015 Open Source Matters. All rights reserved.</copyright>
<creationDate>##DATE##</creationDate>
<copyright>(C) 2005 - ##YEAR## Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1</version>
<version>##VERSION##</version>
<description>COM_WEBLINKS_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>
@ -33,17 +33,12 @@
</schemas>
</update>
<files folder="site">
<filename>weblinks.php</filename>
<filename>controller.php</filename>
<filename>router.php</filename>
<filename>metadata.xml</filename>
<folder>views</folder>
<folder>models</folder>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>language</folder>
<files folder="components/com_weblinks">
##FRONTEND_COMPONENT_FILES##
</files>
<languages folder="language">
##FRONTEND_LANGUAGE_FILES##
</languages>
<administration>
<menu img="class:weblinks">com_weblinks</menu>
<submenu>
@ -56,19 +51,12 @@
<menu link="option=com_categories&amp;extension=com_weblinks"
view="categories" img="class:weblinks-cat" alt="Weblinks/Categories">com_weblinks_categories</menu>
</submenu>
<files folder="admin">
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>weblinks.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>language</folder>
<folder>models</folder>
<folder>sql</folder>
<folder>tables</folder>
<folder>views</folder>
<files folder="administrator/components/com_weblinks">
##BACKEND_COMPONENT_FILES##
</files>
<languages folder="administrator/language">
##BACKEND_LANGUAGE_FILES##
</languages>
</administration>
</extension>

View File

@ -1,162 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>mod_weblinks</name>
<author>Joomla! Project</author>
<creationDate>July 2009</creationDate>
<copyright>Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1</version>
<description>MOD_WEBLINKS_XML_DESCRIPTION</description>
<files>
<folder>language</folder>
<folder>tmpl</folder>
<filename module="mod_weblinks">mod_weblinks.php</filename>
<filename>helper.php</filename>
</files>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_WEBLINKS" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="catid"
type="category"
extension="com_weblinks"
required="true"
label="JCATEGORY"
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
<field
name="count"
type="text"
default="5"
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
<field
name="ordering"
type="list"
default="title"
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
<option
value="title">JGLOBAL_TITLE</option>
<option
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
<option
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
</field>
<field
name="direction"
type="list"
default="asc"
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
<option
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
<option
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
</field>
<field
name="target"
type="list"
default="3"
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
<option
value="1">JBROWSERTARGET_NEW</option>
<option
value="2">JBROWSERTARGET_POPUP</option>
<option
value="3">JBROWSERTARGET_PARENT</option>
</field>
<field
name="follow"
type="list"
default="0"
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
<option
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
<option
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
</field>
<field
name="description"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="hits"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
description="MOD_WEBLINKS_FIELD_HITS_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="count_clicks"
type="list"
class="chzn-color"
default="0"
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
<option
value="">JGLOBAL_USE_GLOBAL</option>
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
</fieldset>
<fieldset
name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field
name="moduleclass_sfx"
type="textarea" rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field
name="cachemode"
type="hidden"
default="static">
<option
value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>mod_weblinks</name>
<author>Joomla! Project</author>
<creationDate>##DATE##</creationDate>
<copyright>Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>##VERSION##</version>
<description>MOD_WEBLINKS_XML_DESCRIPTION</description>
<files>
##MODULE_FILES##
</files>
<languages folder="language">
##LANGUAGE_FILES##
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_WEBLINKS" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="catid"
type="category"
extension="com_weblinks"
required="true"
label="JCATEGORY"
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
<field
name="count"
type="text"
default="5"
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
<field
name="ordering"
type="list"
default="title"
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
<option
value="title">JGLOBAL_TITLE</option>
<option
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
<option
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
</field>
<field
name="direction"
type="list"
default="asc"
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
<option
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
<option
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
</field>
<field
name="target"
type="list"
default="3"
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
<option
value="1">JBROWSERTARGET_NEW</option>
<option
value="2">JBROWSERTARGET_POPUP</option>
<option
value="3">JBROWSERTARGET_PARENT</option>
</field>
<field
name="follow"
type="list"
default="0"
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
<option
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
<option
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
</field>
<field
name="description"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="hits"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
description="MOD_WEBLINKS_FIELD_HITS_DESC">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="count_clicks"
type="list"
class="chzn-color"
default="0"
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
<option
value="">JGLOBAL_USE_GLOBAL</option>
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
</fieldset>
<fieldset
name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field
name="moduleclass_sfx"
type="textarea" rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field
name="cachemode"
type="hidden"
default="static">
<option
value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -2,15 +2,17 @@
<extension version="3.1" type="plugin" group="finder" method="upgrade">
<name>plg_finder_weblinks</name>
<author>Joomla! Project</author>
<creationDate>August 2011</creationDate>
<copyright>(C) 2005 - 2015 Open Source Matters. All rights reserved.</copyright>
<creationDate>##DATE##</creationDate>
<copyright>(C) 2005 - ##YEAR## Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1</version>
<version>##VERSION##</version>
<description>PLG_FINDER_WEBLINKS_XML_DESCRIPTION</description>
<files>
<filename plugin="weblinks">weblinks.php</filename>
<folder>language</folder>
##FILES##
</files>
<languages folder="administrator/language">
##LANGUAGE_FILES##
</languages>
</extension>

View File

@ -2,17 +2,19 @@
<extension version="3.1" type="plugin" group="search" method="upgrade">
<name>plg_search_weblinks</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved.</copyright>
<creationDate>##DATE##</creationDate>
<copyright>Copyright (C) 2005 - ##YEAR## Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1</version>
<version>##VERSION##</version>
<description>PLG_SEARCH_WEBLINKS_XML_DESCRIPTION</description>
<files>
<filename plugin="weblinks">weblinks.php</filename>
<folder>language</folder>
##FILES##
</files>
<languages folder="administrator/language">
##LANGUAGE_FILES##
</languages>
<config>
<fields name="params">

View File

@ -38,6 +38,7 @@ modules:
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/tests/joomla-cms3' # the url for the weblink item used to test hits counter
url: 'http://localhost/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: ~

View File

@ -25,6 +25,7 @@ class AdministratorWeblinksCest
$I->amGoingTo('Navigate to Weblinks page in /administrator/ and verify the Tabs');
$I->amOnPage('administrator/index.php?option=com_weblinks&view=weblinks');
$I->waitForText('Web Links', '30', ['css' => 'h1']);
$I->clickToolbarButton('New');
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
$I->verifyAvailableTabs(['New Web Link', 'Images', 'Publishing', 'Options', 'Metadata']);

View File

@ -26,8 +26,10 @@ class InstallWeblinksCest
{
$I->doAdministratorLogin();
$I->comment('get Weblinks repository folder from acceptance.suite.yml (see _support/AcceptanceHelper.php)');
$path = $I->getConfiguration('repo_folder');
$I->installExtensionFromFolder(rtrim($path, "/") . '/src/com_weblinks/');
// URL where the package file to install is located (mostly the same as joomla-cms)
$url = $I->getConfiguration('url');
$I->installExtensionFromUrl($url . "/pkg-weblinks-current.zip");
$I->doAdministratorLogout();
}
}