Mage_Reports_Model_Test Class Reference

Inheritance diagram for Mage_Reports_Model_Test:

Varien_Object

List of all members.

Public Member Functions

 getUsersCountries ()
 getUsersCities ($countryId)
 getTimelineData ()
 getAllLinearExample ()
 getNewLinearData ()


Detailed Description

Definition at line 36 of file Test.php.


Member Function Documentation

getAllLinearExample (  ) 

Definition at line 78 of file Test.php.

00079     {
00080         $session = Mage::getModel('session_data/');
00081 
00082         $startPoint = time() - 24*60*60;
00083 
00084         $allData = array();
00085         $countOfStartData = 12;
00086         for($i = 1; $i<= $countOfStartData; $i++)
00087         {
00088             $allData[] = array( 'time'=>date("Y-m-d H:i",$startPoint), 'value'=>rand(1, 100) );
00089             $startPoint += 30*60;
00090         }
00091 
00092         $allData[] = array( 'time'=>date("Y-m-d H:i",$startPoint+(90*60)));
00093 
00094         $session -> setData('startPoint', $startPoint);
00095 
00096         return $this -> returnAsDataSource( $allData );
00097     }

getNewLinearData (  ) 

Definition at line 99 of file Test.php.

00100     {
00101         $session = Mage::getModel('session_data/');
00102 
00103 
00104         $startPoint = $session -> getData('startPoint');
00105 
00106         $reset = 12;
00107 
00108 
00109         $newData  = array(
00110             array( 'time'=> date("Y-m-d H:i", $startPoint), 'value'=>rand(1, 100) )
00111         );
00112 
00113         $startPoint += 30*60;
00114         $newData[]  = array( 'time'=> date("Y-m-d H:i", $startPoint+(90*60)) );
00115 
00116         $session -> setData('startPoint', $startPoint);
00117 
00118         return $this -> returnAsDataSource( $newData, $reset );
00119     }

getTimelineData (  ) 

Definition at line 73 of file Test.php.

00074     {
00075         return file_get_contents( Mage::getModuleDir('etc','Mage_Reports').DS.'flexTestDataTimeline.xml' );
00076     }

getUsersCities ( countryId  ) 

Definition at line 44 of file Test.php.

00045     {
00046         $dom = new DOMDocument();
00047         $dom -> preserveWhiteSpace = false;
00048         $dom -> load( Mage::getModuleDir('etc','Mage_Reports').DS.'flexTestDataCities.xml' );
00049 
00050         $root = $dom -> documentElement;
00051         $rows = $root -> getElementsByTagName( 'row' );
00052 
00053         $childsToRemove = array();
00054         for( $i = 0; $i < $rows -> length; $i++)
00055         {
00056             for( $j = 0; $j < $rows -> item($i) -> childNodes -> length; $j ++ )
00057                 if(
00058                     $rows -> item($i) -> childNodes -> item($j) -> nodeType == XML_ELEMENT_NODE
00059                         &&
00060                     $rows -> item($i) -> childNodes -> item($j) -> nodeName == 'countryId'
00061                         &&
00062                     $rows -> item($i) -> childNodes -> item($j) -> nodeValue != $countryId
00063                 )
00064                     $childsToRemove[] = $rows -> item($i);
00065         }
00066 
00067         foreach( $childsToRemove as $child )
00068             $root -> removeChild( $child );
00069 
00070         return $dom -> saveXML();
00071     }

getUsersCountries (  ) 

Definition at line 39 of file Test.php.

00040     {
00041         return file_get_contents( Mage::getModuleDir('etc','Mage_Reports').DS.'flexTestDataCountries.xml' );
00042     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:37 2009 for Magento by  doxygen 1.5.8