Remove cc_locale table and add Selenium running script

* Fixes CC-5906
This commit is contained in:
Albert Santoni 2014-08-26 13:32:35 -04:00
parent 871ddb47d8
commit d1971b6d2b
4 changed files with 82 additions and 15 deletions

View File

@ -2,17 +2,32 @@
class Application_Model_Locale
{
public static $locales = array(
"en_CA" => "English (Canada)",
"en_GB" => "English (Britain)",
"en_US" => "English (USA)",
"cs_CZ" => "Český",
"de_DE" => "Deutsch",
"de_AT" => "Deutsch (Österreich)",
"el_GR" => "Ελληνικά",
"es_ES" => "Español",
"fr_FR" => "Français",
"hr_HR" => "Hrvatski",
"hu_HU" => "Magyar",
"it_IT" => "Italiano",
//"ja" => "日本語",
"ko_KR" => "한국어",
"pl_PL" => "Polski",
"pt_BR" => "Português (Brasil)",
"ru_RU" => "Русский",
"sr_RS" => "Српски (Ћирилица)",
"sr_RS@latin" => "Srpski (Latinica)",
"zh_CN" => "简体中文"
);
public static function getLocales()
{
$con = Propel::getConnection();
$sql = "SELECT * FROM cc_locale";
$res = Application_Common_Database::prepareAndExecute($sql);
$out = array();
foreach ($res as $r) {
$out[$r["locale_code"]] = $r["locale_lang"];
}
return $out;
return self::$locales;
}
public static function configureLocalization($locale = null)
@ -32,4 +47,5 @@ class Application_Model_Locale
textdomain($domain);
bind_textdomain_codeset($domain, $codeset);
}
}
}

View File

@ -474,11 +474,6 @@
<reference local="mount_name_id" foreign="id"/>
</foreign-key>
</table>
<table name="cc_locale" phpName="CcLocale">
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
<column name="locale_code" phpName="DbLocaleCode" type="VARCHAR" size="16" required="true" />
<column name="locale_lang" phpName="DbLocaleLang" type="VARCHAR" size="128" required="true" />
</table>
<table name="cc_playout_history" phpName="CcPlayoutHistory">
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />

13
tests/README Normal file
View File

@ -0,0 +1,13 @@
Airtime Tests
Selenium:
- No prerequisites required.
- To set it up and run it, run:
$ ./run_selenium.sh
Airtime web app unit tests:
- See airtime_mvc/tests/README
Airtime Analyzer unit tests
- See python_app/airtime_analyzer/README

43
tests/run_selenium.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
SELENIUM_BIN=selenium-server-standalone-2.42.2.jar
SELENIUM_URL=http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
printUsage()
{
echo "Usage: ${0} airtime_url"
echo " Example: ${0} http://bananas.airtime.pro"
}
if [ -z "$1" ]
then
printUsage
exit 1
fi
AIRTIME_URL="${1}"
# Check if java is installed
which java >& /dev/null
if [ $? -gt 0 ]
then
echo "java not found. Please install it."
fi
# Check for selenium-server
if [ ! -f ${SELENIUM_BIN} ]
then
echo "Selenium not found, downloading it..."
wget ${SELENIUM_URL}
fi
# Check for xvfb-run, which lets us run Firefox in a headless X server
which xvfb-run >& /dev/null
if [ $? -gt 0 ]
then
echo "xvfb-run not found, apt-getting it now..."
sudo apt-get install xvfb
fi
# You must pass the full path to the HTML suite and the results file to Selenium:
xvfb-run java -jar ${SELENIUM_BIN} -htmlSuite "*firefox" "${AIRTIME_URL}" "${PWD}"/selenium/Airtime.html "${PWD}"/results.html