CC-1927 Remove PEAR DB

* Removed all traces of PEAR functions.
* Fixed AirtimeInstall::GetVersionInstalled() to return the correct answer
  even when it cant connect to the database.  Also fixed return value to
  be consistent on failure.
* Fixed phone_home_stat.php and soundcloud-uploader.php
This commit is contained in:
paul.baranowski 2012-04-05 02:22:21 -04:00 committed by Martin Konecny
parent c0da27b445
commit 96b010e7f0
10 changed files with 65 additions and 120 deletions

View file

@ -3,7 +3,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$WHITE_SCREEN_OF_DEATH = false;
require_once(dirname(__FILE__).'/../../configs/conf.php');
require_once('DB.php');
require_once('PHPUnit.php');
require_once 'StoredFileTests.php';
require_once 'SchedulerTests.php';

View file

@ -46,9 +46,6 @@ class SchedulerTests extends PHPUnit_TestCase {
function testAddAndRemoveAudioFile() {
$i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
$i = new Application_Model_ScheduleGroup($this->groupIdCreated);
$result = $i->remove();
@ -67,9 +64,6 @@ class SchedulerTests extends PHPUnit_TestCase {
$i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
$group = new Application_Model_ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
@ -90,10 +84,6 @@ class SchedulerTests extends PHPUnit_TestCase {
function testIsScheduleEmptyInRange() {
$i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail($this->groupIdCreated->getMessage());
return;
}
if (Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
$this->fail("Reporting empty schedule when it isnt.");
return;

View file

@ -1,14 +1,6 @@
<?php
require_once(dirname(__FILE__).'/../StoredFile.php');
$dsn = $CC_CONFIG['dsn'];
$CC_DBC = DB::connect($dsn, FALSE);
if (PEAR::isError($CC_DBC)) {
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
exit(1);
}
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
class StoredFileTest extends PHPUnit_TestCase {
function __construct($name) {
@ -21,10 +13,6 @@ class StoredFileTest extends PHPUnit_TestCase {
function testGetAudioMetadata() {
$filePath = dirname(__FILE__)."/ex1.mp3";
$metadata = Metadata::LoadFromFile($filePath);
if (PEAR::isError($metadata)) {
$this->fail($metadata->getMessage());
return;
}
if (($metadata["dc:description"] != "Tmu sem tam videla ...")
|| ($metadata["audio"]["dataformat"] != "mp3")
|| ($metadata["dc:type"] != "Speech")) {
@ -52,10 +40,6 @@ class StoredFileTest extends PHPUnit_TestCase {
$values = array("filepath" => $filePath,
"dc:description" => "Unit test ".time());
$storedFile = Application_Model_StoredFile::Insert($values, false);
if (PEAR::isError($storedFile)) {
$this->fail("Failed to create StoredFile: ".$storedFile->getMessage());
return;
}
//var_dump($storedFile);
$id = $storedFile->getId();
if (!is_numeric($id)) {