From d1971b6d2bdc6e45b11685706250449c6420d415 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 26 Aug 2014 13:32:35 -0400 Subject: [PATCH] Remove cc_locale table and add Selenium running script * Fixes CC-5906 --- airtime_mvc/application/models/Locale.php | 36 +++++++++++++------ airtime_mvc/build/schema.xml | 5 --- tests/README | 13 +++++++ tests/run_selenium.sh | 43 +++++++++++++++++++++++ 4 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 tests/README create mode 100755 tests/run_selenium.sh diff --git a/airtime_mvc/application/models/Locale.php b/airtime_mvc/application/models/Locale.php index c07c9974c..328344496 100644 --- a/airtime_mvc/application/models/Locale.php +++ b/airtime_mvc/application/models/Locale.php @@ -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); } -} \ No newline at end of file +} + diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index d5ba76516..6dea9ac7c 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -474,11 +474,6 @@ - - - - -
diff --git a/tests/README b/tests/README new file mode 100644 index 000000000..60dff673d --- /dev/null +++ b/tests/README @@ -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 diff --git a/tests/run_selenium.sh b/tests/run_selenium.sh new file mode 100755 index 000000000..761c386ae --- /dev/null +++ b/tests/run_selenium.sh @@ -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 +