Commit 19c4fe18 authored by Rob Myers's avatar Rob Myers

Move to Composer for dependency management.

Files now include  ...vendor/autoload.php where needed and the
external_dependencies folder has been removed. The installation instructions
have been updated to reflect these changes. nixtape and gnukebox have separate
composer files to ease separate installation.
Feedback on this strategy is welcomed.

Use phpunit rather than simpletest for all tests. simpletest is no longer a
dependency.

Update to current versions of libraries. Where this has caused errors to be
logged (notably for templates) code has been changed to resolve them.
parent 5784e50a
gnukebox/config.php
gnukebox/vendor
nixtape/config.php
nixtape/themes/gnufm/templates_c/
nixtape/vendor
Other external dependencies which are currently bundled within the nixtape source tree:
- jQuery 1.3.2
- ARC2
--- Installing GNU FM ---
If for any reason you might need assistance following these instructions, please don't
hestitate to join us at #libre.fm @ freenode (IRC).
If for any reason you might need assistance following these instructions,
please don't hestitate to join us at #libre.fm @ freenode (IRC).
Dependencies:
- Postgresql (recommended) / MySQL / SQlite (untested?)
......@@ -11,10 +11,13 @@ Dependencies:
- Smarty + Smarty-gettext (see footnote)
- Database modules for PHP
(this guide assumes you are capable of creating a user and database yourself)
PHP dependencies (AdoDB, Smarty, Smarty-gettext) are managed via composer.
(This guide assumes you are capable of creating a user and database yourself.)
TODO: Write guide for creating user and database
First, grab yourself a copy of the code. It is available here:
http://gitorious.org/foocorp/gnu-fm
The checkout should contain a bunch of folders, the only ones we're
......@@ -23,49 +26,52 @@ interested in at the moment are the ones called "gnukebox" and "nixtape".
GNU FM is divided into two modules: gnukebox, which receives scrobbles, and
nixtape, which is the web frontend and provides the webservices (such as radio).
Although gnukebox and nixtape have the same dependencies, they have separate
composer files to make separate installation easier.
--------------------------------------------------------------------------------
Gnukebox:
Installing gnukebox is easy:
(1) Copy the contents of gnukebox to the root of a vhost.
(2) Set up correct permissions on files and folders
(3) Run 'install.php' through a web browser.
(2) Run 'composer install' in that directory.
(3) Set up correct permissions on files and folders.
(4) Run 'install.php' through a web browser.
Gnukebox needs to be at the root of a vhost, simply because that's where clients
expect it to be. For the rest of this document I'll assume gnukebox is accessible
through the address 'gnukebox.local'. To complete step 1, copy the contents of
the "gnukebox"-folder to the root of your vhost:
Gnukebox needs to be at the root of a vhost, simply because that's where
clients expect it to be. For the rest of this document I'll assume gnukebox is
accessible through the address 'gnukebox.local'. To complete step 1, copy the
contents of the "gnukebox" folder to the root of your vhost:
$ cp -r gnukebox/* /var/www/htdocs/gnukebox/.
/var/www/htdocs/gnukebox is just where I've set up my gnukebox-vhost in Apache.
Gnukebox relies on an external database abstraction layer called ADOdb. This can be installed
systemwide through a package manager or locally for gnukebox only by extracting the ADOdb-archive
present in the "external_dependencies"-folder.
To install ADOdb system wide either use your distributions package manager or find a guide that
tells you how to do it manually. If you decide to use a local copy you will need to repeat this
step when installing nixtape.
Install the dependencies using composer:
To use a local copy of ADOdb:
$ cp external_dependencies/adodb511.tgz /var/www/htdocs/gnukebox/.
$ cd /var/www/htdocs/gnukebox
$ tar zxvf adodb511.tgz
$ mv adodb5 adodb
$ cd /var/www/htdocs/gnukebox
$ composer install
Now run these commands as root to correctly set permissions (assuming www-data is the user
your webserver runs under).
Now run these commands as root to correctly set permissions (assuming www-data
is the user your webserver runs under).
$ chown www-data:www-data -R /var/www/htdocs/gnukebox
Now point your browser to 'http://gnukebox.local/install.php'.
Just fill in the appropriate details and click 'Install'. This should connect to the database,
create the appropriate tables and complete the 'config.php'-file in the gnukebox-directory.
If the script was unable to create the file, it will echo the contents to the screen and tell
you to create it yourself. Note: Some users have reported getting a Server 500-error here.
If you do, see if the tables were created and if 'config.php' has appeared in your gnukebox-folder.
Just fill in the appropriate details and click 'Install'. This should connect
to the database, create the appropriate tables and complete the 'config.php'
file in the gnukebox-directory.
---------------------------------------------------------------------------------------------------
If the script was unable to create the file, it will echo the contents to the
screen and tell you to create it yourself.
Note: Some users have reported getting a Server 500-error here. If you do, see
if the tables were created and if 'config.php' has appeared in your gnukebox
folder.
--------------------------------------------------------------------------------
Nixtape:
......@@ -75,33 +81,11 @@ Installing the base system:
$ cp -r nixtape/* /var/www/htdocs/nixtape/.
$ mkdir /var/www/htdocs/nixtape/themes/gnufm/templates_c
Installing dependencies (Smarty+AdoDB):
Both Smarty and AdoDB can be downloaded and placed in the gnukebox-folder (both are also located in
the folder "external_dependencies"). If installed through a package manager, make sure Smarty
is installed correctly[1]. When unpacking Smarty, move all files in smarty/libs/ to smarty/.
Installing Smarty:
$ cd external_dependencies
$ cp Smarty* /var/www/htdocs/nixtape/.
$ cp smarty* /var/www/htdocs/nixtape/.
$ tar zxvf Smarty*
$ tar zxvf smarty*
$ mv smarty/libs/* smarty/.
$ mv smarty-gettext/block.t.php smarty/plugins/.
Installing ADOdb:
$ cp external_dependencies/adodb511.tgz /var/www/htdocs/nixtape/.
$ cd /var/www/htdocs/nixtape
$ tar zxvf adodb511.tgz
$ mv adodb5 adodb
Installing dependencies:
$ cd /var/www/htdocs/nixtape/
$ composer install
Setting the correct permissions:
$ chown www-data:www-data -R /var/www/htdocs/nixtape
Now access your installation through a browser and follow the instructions.
__________________________________________________________________________
[1] Debian installs Smarty wrong and Ubuntu installs Smarty-Gettext wrong.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514305 and
https://bugs.launchpad.net/ubuntu/+source/smarty-gettext/+bug/150461
{
"require": {
"adodb/adodb-php": "~5.19",
"smarty/smarty": "~3.1",
"smarty-gettext/smarty-gettext": "~1.1.1"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
}
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,8 +25,6 @@ if (!file_exists(dirname(__FILE__) . '/config.php')) {
}
require_once('config.php');
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
try {
$adodb =& NewADOConnection($connect_string);
......
......@@ -2,7 +2,7 @@
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009, 2011 Free Software Foundation, Inc
Copyright (C) 2009, 2011, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -114,7 +114,7 @@ PT+wyF3sxnlLADr6ApYcCQvAxHJLyUHQySqJx5+kAABArRU6QMrASTlYQ7gFsDVdowWsjLStEQIA
Ow==" alt="" />
<p>The Libre.fm wiki has a <a
href="http://bugs.foocorp.net/projects/librefm/wiki/Clients">good list
href="https://bugz.foocorp.net/w/projects/libre.fm/clients/">good list
of players</a> that can be configured to support GNU FM servers, such
as this one.</p>
......
......@@ -2,7 +2,7 @@
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -19,8 +19,7 @@
*/
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
require_once(__DIR__ . '/vendor/autoload.php');
require_once('version.php');
require_once('utils/get_absolute_url.php');
......@@ -444,7 +443,7 @@ if (isset($_POST['install'])) {
$install_path = dirname(__FILE__) . '/';
//Write out the configuration
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "'; ";
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "';\n\n require_once(__DIR__ . '/vendor/autoload.php');\n";
$conf_file = fopen('config.php', 'w');
$result = fwrite($conf_file, $config);
......
<?php
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -18,8 +18,7 @@
*/
require_once('PHPUnit/Framework.php');
require_once('HTTP/Request.php');
require_once(__DIR__ . '/../vendor/autoload.php');
class SubmissionsTest extends PHPUnit_Framework_TestCase {
// Check we can login with standard authentication
......@@ -44,7 +43,8 @@ class SubmissionsTest extends PHPUnit_Framework_TestCase {
$session_id = trim($result[1]);
$scrobble_server = trim($result[3]);
$result = $this->scrobble($scrobble_server, $session_id, 'Richard Stallman',
$result = $this->scrobble($scrobble_server, $session_id,
'Richard Stallman',
'The Free Software Song', 'b25b9595-54ed-7605-8ac2-20b7b2e0a026');
$this->assertEquals('OK', trim($result));
sleep(1);
......@@ -57,7 +57,8 @@ class SubmissionsTest extends PHPUnit_Framework_TestCase {
$session_id = trim($result[1]);
$nowplaying_server = trim($result[2]);
$result = $this->nowPlaying($nowplaying_server, $session_id, 'The Libre.fm Players', 'Let Freedom Ring',
$result = $this->nowPlaying($nowplaying_server, $session_id,
'The Libre.fm Players', 'Let Freedom Ring',
'b25b9595-54ed-7605-8ac2-20b7b2e0a026');
$this->assertEquals('OK', trim($result));
sleep(1);
......@@ -75,26 +76,26 @@ class SubmissionsTest extends PHPUnit_Framework_TestCase {
private function scrobble($server, $session_id, $artist, $track) {
$r = new HTTP_Request($server);
$r->setMethod(HTTP_REQUEST_METHOD_POST);
$r->addPostData('s', $session_id);
$r->addPostData('a[0]', $artist);
$r->addPostData('t[0]', $track);
$r->addPostData('i[0]', time());
$r->addPostData('m[0]', $mbid);
$r->addPostData('o[0]', 'U');
$r->sendRequest();
$r = new HttpRequest($server);
$r->setMethod(HTTP_METH_POST);
$r->addPostFields(['s'=>$session_id,
'a[0]'=>$artist,
't[0]'=>$track,
'i[0]'=>time(),
'm[0]'=>$mbid,
'o[0]'=>'U']);
$r->send();
return $r->getResponseBody();
}
private function nowPlaying($server, $session_id, $artist, $track, $mbid) {
$r = new HTTP_Request($server);
$r->setMethod(HTTP_REQUEST_METHOD_POST);
$r->addPostData('s', $session_id);
$r->addPostData('a', $artist);
$r->addPostData('t', $track);
$r->sendRequest();
$r = new HttpRequest($server);
$r->setMethod(HTTP_METH_POST);
$r->addPostFields(['s'=>$session_id,
'a'=>$artist,
't'=>$track]);
$r->send();
return $r->getResponseBody();
}
}
{
"require": {
"adodb/adodb-php": "~5.19",
"smarty/smarty": "~3.1",
"smarty-gettext/smarty-gettext": "~1.1.1"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
}
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
/* GNU FM -- a free network service for sharing your music listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,8 +25,6 @@ if (!file_exists(dirname(__FILE__) . '/config.php')) {
}
require_once('config.php');
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
try {
$adodb =& NewADOConnection($connect_string);
......
......@@ -2,7 +2,7 @@
/* GNU FM -- a free network service for sharing your music listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -19,8 +19,7 @@
*/
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
require_once(__DIR__ . '/vendor/autoload.php');
require_once('version.php');
require_once('utils/get_absolute_url.php');
......@@ -62,7 +61,7 @@ if (isset($_POST['install'])) {
$submissions_server = $_POST['submissions_server'];
//Write out the configuration
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n \$site_name = '" . $site_name . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "';\n \$gnufm_key = 'default_gnufm_32_char_identifier'; ";
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n \$site_name = '" . $site_name . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "';\n \$gnufm_key = 'default_gnufm_32_char_identifier';\n $registration_disabled = false;\n\n require_once(__DIR__ . '/vendor/autoload.php');\n";
$conf_file = fopen('config.php', 'w');
$result = fwrite($conf_file, $config);
......
......@@ -2,7 +2,7 @@
/* GNU FM -- a free network service for sharing your music listening habits
Copyright (C) 2009 Free Software Foundation, Inc
Copyright (C) 2009, 2015 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -19,10 +19,8 @@
*/
define('SMARTY_DIR', '/usr/share/php/smarty3/');
require_once('config.php');
require_once('auth.php');
require_once(SMARTY_DIR . 'Smarty.class.php');
function displayError($error_title, $error_message) {
global $smarty;
......@@ -71,13 +69,14 @@ $smarty->setTemplateDir(array(
$install_path . '/themes/gnufm/templates/'
));
$smarty->setPluginsDir(array(
SMARTY_DIR . '/plugins/',
__DIR__ . '/vendor/smarty/smarty/libs/plugins/',
$install_path. '/themes/' . $theme . '/plugins/',
$install_path . '/themes/gnufm/plugins/'
));
$smarty->setCompileDir($install_path . '/themes/' . $theme . '/templates_c/');
$smarty->setCacheDir($install_path . '/cache/');
$smarty->setConfigDir(array($install_path . '/themes/' . $theme . '/config/', $install_path . '/themes/gnufm/config/'));
$smarty->setConfigDir(array($install_path . '/themes/' . $theme . '/config/',
$install_path . '/themes/gnufm/config/'));
$current_lang = preg_replace('/.UTF-8/', '', $current_lang);
$smarty->assign('lang_selector_array', array(($current_lang) => 1));
......@@ -101,4 +100,3 @@ if (isset($logged_in) && $logged_in) {
}
header('Content-Type: text/html; charset=utf-8');
......@@ -2,6 +2,7 @@
</article>
<aside>
{include file='search-box.tpl'}
{if isset($sideblocks)}
{foreach from=$sideblocks item=block}
<div class='sideblock-top'></div>
{include file=$block}
......@@ -11,6 +12,7 @@
{include file='sidebar-tips.tpl'}
<div class='sideblock-bottom'></div>
{/foreach}
{/if}
<div class='sideblock-top'></div>
{include file='sidebar-ads.tpl'}
<div class='sideblock-bottom'></div>
......
......@@ -8,7 +8,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{if !($pagetitle)}
{if ! isset($pagetitle)}
<title>{$site_name}</title>
{else}
<title>{$pagetitle|escape:'html':'UTF-8'} &mdash; {$site_name}</title>
......@@ -23,9 +23,11 @@
<script type="text/javascript" src="{$base_url}/js/player.js"></script>
<script type="text/javascript" src="{$base_url}/themes/{$default_theme}/js/modernizr.js"></script>
<meta name="author" content="FooCorp catalogue number FOO200 and contributors" />
{if isset($extra_head_links)}
{section name=i loop=$extra_head_links}
<link rel="{$extra_head_links[i].rel|escape:'html':'UTF-8'}" href="{$extra_head_links[i].href|escape:'UTF-8'}" type="{$extra_head_links[i].type|escape:'html':'UTF-8'}" title="{$extra_head_links[i].title|escape:'html':'UTF-8'}" />
{/section}
{/if}
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
......
......@@ -2,21 +2,21 @@
<label for='lang'>{t}Preferred language:{/t} </label>
<select name='lang' id='lang' onchange='this.form.submit()'>
<optgroup label="{t}Please select your language{/t}">
<option {if $lang_selector_array.en_US}selected="selected"{/if} value='en_US'>English</option>
<option {if $lang_selector_array.ca_ES}selected="selected"{/if} value='ca_ES'>Català</option>
<option {if $lang_selector_array.cs_CZ}selected="selected"{/if} value='cs_CZ'>Čeština</option>
<option {if $lang_selector_array.cy_GB}selected="selected"{/if} value='cy_GB'>Cymraeg</option>
<option {if $lang_selector_array.de_DE}selected="selected"{/if} value='de_DE'>Deutsch</option>
<option {if $lang_selector_array.es_ES}selected="selected"{/if} value='es_ES'>Español</option>
<option {if $lang_selector_array.eo}selected="selected"{/if} value='eo'>Esperanto</option>
<option {if $lang_selector_array.fi_FI}selected="selected"{/if} value='fi_FI'>Finnish</option>
<option {if $lang_selector_array.fr_FR}selected="selected"{/if} value='fr_FR'>Français</option>
<option {if $lang_selector_array.gl_ES}selected="selected"{/if} value='gl_ES'>Galician</option>
<option {if $lang_selector_array.nl_NL}selected="selected"{/if} value='nl_NL'>Nederlands</option>
<option {if $lang_selector_array.pt_BR}selected="selected"{/if} value='pt_BR'>Português Brasileiro</option>
<option {if $lang_selector_array.ru_RU}selected="selected"{/if} value='ru_RU'>Pусский язык</option>
<option {if $lang_selector_array.sq_AL}selected="selected"{/if} value='sq_AL'>Shqip</option>
<option {if $lang_selector_array.sl_SI}selected="selected"{/if} value='sl_SI'>Slovenščina</option>
<option {if array_key_exists('en_US', $lang_selector_array)}selected="selected"{/if} value='en_US'>English</option>
<option {if array_key_exists('ca_ES', $lang_selector_array)}selected="selected"{/if} value='ca_ES'>Català</option>
<option {if array_key_exists('cs_CZ', $lang_selector_array)}selected="selected"{/if} value='cs_CZ'>Čeština</option>
<option {if array_key_exists('cy_GB', $lang_selector_array)}selected="selected"{/if} value='cy_GB'>Cymraeg</option>
<option {if array_key_exists('de_DE', $lang_selector_array)}selected="selected"{/if} value='de_DE'>Deutsch</option>
<option {if array_key_exists('es_ES', $lang_selector_array)}selected="selected"{/if} value='es_ES'>Español</option>
<option {if array_key_exists('eo', $lang_selector_array)}selected="selected"{/if} value='eo'>Esperanto</option>
<option {if array_key_exists('fi_FI', $lang_selector_array)}selected="selected"{/if} value='fi_FI'>Finnish</option>
<option {if array_key_exists('fr_FR', $lang_selector_array)}selected="selected"{/if} value='fr_FR'>Français</option>
<option {if array_key_exists('gl_ES', $lang_selector_array)}selected="selected"{/if} value='gl_ES'>Galician</option>
<option {if array_key_exists('nl_NL', $lang_selector_array)}selected="selected"{/if} value='nl_NL'>Nederlands</option>
<option {if array_key_exists('pt_BR', $lang_selector_array)}selected="selected"{/if} value='pt_BR'>Português Brasileiro</option>
<option {if array_key_exists('ru_RU', $lang_selector_array)}selected="selected"{/if} value='ru_RU'>Pусский язык</option>
<option {if array_key_exists('sq_AL', $lang_selector_array)}selected="selected"{/if} value='sq_AL'>Shqip</option>
<option {if array_key_exists('sl_SI', $lang_selector_array)}selected="selected"{/if} value='sl_SI'>Slovenščina</option>
</optgroup>
</select>
<noscript>
......
<ul>
{if ($logged_in)}
{if isset($logged_in) && $logged_in}
<li><a href="{$this_user->getURL()}">{t}Profile{/t}</a></li>
<li><a href="{$base_url}/listen.php">{t}Listen{/t}</a></li>
<li><a href="{$base_url}">{t}Popular{/t}</a></li>
......
......@@ -3,11 +3,11 @@
<h3>Search</h3>
<form action='{$base_url}/search.php' method='get'>
<p><input name='search_term' type='text' size="10" value='{$search_term|escape:'html':'UTF-8'}'/>
<p><input name='search_term' type='text' size="10" value='{if isset($search_term)}{$search_term|escape:'html':'UTF-8'}{/if}'/>
<select name='search_type'>
<option value='artist' {if $search_type == 'artist'}selected{/if}>{t}Artist{/t}</option>
<option value='user' {if $search_type == 'user'}selected{/if}>{t}User{/t}</option>
<option value='tag' {if $search_type == 'tag'}selected{/if}>{t}Tag{/t}</option>
<option value='artist' {if isset($search_type) && $search_type == 'artist'}selected{/if}>{t}Artist{/t}</option>
<option value='user' {if isset($search_type) && $search_type == 'user'}selected{/if}>{t}User{/t}</option>
<option value='tag' {if isset($search_type) && $search_type == 'tag'}selected{/if}>{t}Tag{/t}</option>
</select>
<input type='submit' value='{t}Search{/t}' id='search_button' /></p>
</form>
......
{include file='header.tpl'}
{if ($logged_in)}
{if isset($logged_in) && $logged_in}
<div id="welcome-box">
<br />
<p>{t escape=no userurl=$this_user->getURL() statsurl=$this_user->getURL('stats')}<a href="%1">Go to your profile</a> or <a href="%2">view your listening statistics</a>.{/t}</p>
......
<?php
require_once('simpletest/unit_tester.php');
require_once('simpletest/browser.php');
require_once('simpletest/reporter.php');
require_once(__DIR__ . '/vendor/autoload.php');
define(URL, 'http://ponape.com.ar/libre.fm/trunk/tests');
define(USERNAME, 'testuser');
......@@ -10,7 +8,7 @@ define(PASSWORD, 'goodpassword');
include('web/database.php');
include('web/data/TagCloud.php');
class testLibreFM extends UnitTestCase {
class testLibreFM extends PHPUnit_Framework_TestCase {
function __construct () {
$this->UnitTestCase();
}
......@@ -18,13 +16,13 @@ class testLibreFM extends UnitTestCase {
function testDB () {
global $mdb2, $connect_string;
# Test if the connection string is more or less connectionstringesque :p
$this->assertWantedPattern('/(mysql|sqlite|pgsql):\/\/[a-zA-Z0-9]*:.*@[a-zA-Z0-9]*:[0-9]*\/[a-zA-Z0-9_]*/', $connect_string);
$this->assertRegexp('/(mysql|sqlite|pgsql):\/\/[a-zA-Z0-9]*:.*@[a-zA-Z0-9]*:[0-9]*\/[a-zA-Z0-9_]*/', $connect_string);
$this->assertFalse(PEAR::isError($mdb2));
}
function testTagCloud () {
# Testing if we have an array as result
$this->assertIsA(TagCloud::generateTagCloud('Scrobbles', 'artist', 20, null), 'array');
$this->assertInstanceOf('array', TagCloud::generateTagCloud('Scrobbles', 'artist', 20, null));
}
function login ($username, $password) {
......@@ -52,12 +50,12 @@ class testLibreFM extends UnitTestCase {
function testWebLoginBad() {
$badlogin = $this->WebLogin(USERNAME, 'badpassword');
$this->assertEqual($badlogin->getUrl(), URL . '/web/login.php');
$this->assertEquals($badlogin->getUrl(), URL . '/web/login.php');
}
function testWebLoginGood() {
$goodlogin = $this->WebLogin(USERNAME, PASSWORD);
$this->assertEqual($goodlogin->getUrl(), URL . '/web/index.php');
$this->assertEquals($goodlogin->getUrl(), URL . '/web/index.php');
}
function testWebLogout() {
$logout = $this->WebLogin(USERNAME, PASSWORD);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment