From 7b1d224c1a5d042f06c2ddeb1e807314624bd567 Mon Sep 17 00:00:00 2001
From: Robb Ebright <ebright.48@osu.edu>
Date: Wed, 16 Aug 2017 00:12:16 -0400
Subject: [PATCH] added another test to the block test block

---
 .../models/database/BlockDbTest.php           |  25 ++++
 .../models/database/datasets/seed_files.yml   | 120 ++++++++++++++++++
 .../application/testdata/BlockModelData.php   |  31 +++++
 3 files changed, 176 insertions(+)

diff --git a/airtime_mvc/tests/application/models/database/BlockDbTest.php b/airtime_mvc/tests/application/models/database/BlockDbTest.php
index f2ec203b9..1df24c40d 100644
--- a/airtime_mvc/tests/application/models/database/BlockDbTest.php
+++ b/airtime_mvc/tests/application/models/database/BlockDbTest.php
@@ -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
+    }
+
 }
\ No newline at end of file
diff --git a/airtime_mvc/tests/application/models/database/datasets/seed_files.yml b/airtime_mvc/tests/application/models/database/datasets/seed_files.yml
index 4a7ab4464..c29094a97 100644
--- a/airtime_mvc/tests/application/models/database/datasets/seed_files.yml
+++ b/airtime_mvc/tests/application/models/database/datasets/seed_files.yml
@@ -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'
+
diff --git a/airtime_mvc/tests/application/testdata/BlockModelData.php b/airtime_mvc/tests/application/testdata/BlockModelData.php
index f7dbf43d8..5799a8912 100644
--- a/airtime_mvc/tests/application/testdata/BlockModelData.php
+++ b/airtime_mvc/tests/application/testdata/BlockModelData.php
@@ -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"),
+        );
+
+    }
 }
\ No newline at end of file