added another test to the block test block

This commit is contained in:
Robb Ebright 2017-08-16 00:12:16 -04:00
parent 919c77d8f1
commit 7b1d224c1a
3 changed files with 176 additions and 0 deletions

View File

@ -67,4 +67,29 @@ class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework
// need to load a example criteria into the database
}
/**
* Test if the single newest file is added to the Database
*
*/
public function testMultiTrackandAlbumsGetLoaded() {
TestHelper::loginUser();
$CC_CONFIG = Config::getConfig();
$testqry = CcFilesQuery::create();
$testout = $testqry->find();
$vd = $testout->getData();
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
$this->getConnection()
);
$testCriteria = BlockModelData::getCriteriaMultiTrackAndAlbum1Hour();
$bltest = new Application_Model_Block();
$bltest->saveSmartBlockCriteria($testCriteria);
$tracks = $bltest->getListOfFilesUnderLimit();
//$tracks = $bltest->getLength();
$this->assertNotEmpty($tracks);
// add assertion that the length is less than 1 hour...
// need to load a example criteria into the database
}
}

View File

@ -55,3 +55,123 @@ cc_files:
is_playlist: 'f'
filesize: '5126748'
-
id: '3'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track1.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track1'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '4'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track2.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track2'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '5'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track3.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track3'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '6'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track1-2.mp3'
mtime: '2017-08-06 05:28:36'
utime: '2017-08-16 04:27:47'
track_title: 'track1'
album_title: 'album2'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '7'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track2-2.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track2'
album_title: 'album2'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'

View File

@ -15,4 +15,35 @@ Class BlockModelData
Array("name" => "sp_criteria_value_0_0", "value" => "nada"),
);
}
public static function getCriteriaMultiTrackAndAlbum1Hour()
{
return array (
Array("name" => "sp_type" , "value" => 1),
Array("name" => "sp_repeat_tracks", "value" => 0),
Array("name" => "sp_sort_options", "value" => "random"),
Array("name" => "sp_limit_value", "value" => 1),
Array("name" => "sp_limit_options", "value" => "hours"),
Array("name" => "sp_criteria_field_0_0", "value" => "album_title"),
Array("name" => "sp_criteria_modifier_0_0", "value" => "is"),
Array("name" => "sp_criteria_value_0_0", "value" => "album1"),
Array("name" => "sp_criteria_field_0_1", "value" => "album_title"),
Array("name" => "sp_criteria_modifier_0_1", "value" => "is"),
Array("name" => "sp_criteria_value_0_1", "value" => "album2"),
Array("name" => "sp_criteria_field_1_0", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_0", "value" => "is"),
Array("name" => "sp_criteria_value_1_0", "value" => "track1"),
Array("name" => "sp_criteria_field_1_1", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_1", "value" => "is"),
Array("name" => "sp_criteria_value_1_1", "value" => "track2"),
Array("name" => "sp_criteria_field_1_2", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_2", "value" => "is"),
Array("name" => "sp_criteria_value_1_2", "value" => "track3"),
Array("name" => "sp_criteria_field_2_0", "value" => "length"),
Array("name" => "sp_criteria_modifier_2_0", "value" => "is greater than"),
Array("name" => "sp_criteria_value_2_0", "value" => "00:01:00"),
);
}
}