All Unit tests
Current file: C:\code\midiparser\src\Midi\TrackHeader.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 6 / 6
100.00%100.00%
100.00% 12 / 12
 
Midi\TrackHeader
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 6 / 6
100.00%100.00%
100.00% 12 / 12
 public function __construct($size)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function getSize()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public function getLength()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public function getData()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public function toBinary()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 5 / 5
 public function __toString()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1


       1                 : <?php                                                               
       2                 :                                                                     
       3                 :     /**                                                             
       4                 :      * \Midi\TrackHeader                                            
       5                 :      *                                                              
       6                 :      * @package   Midi                                              
       7                 :      * @copyright © 2009 Tommy Montgomery <http://phpmidiparser.com>
       8                 :      * @since     1.0                                               
       9                 :      */                                                             
      10                 :                                                                     
      11                 :     namespace Midi;                                                 
      12                 :                                                                     
      13                 :     /**                                                             
      14                 :      * Represents a MIDI track header                               
      15                 :      *                                                              
      16                 :      * @package Midi                                                
      17                 :      * @since   1.0                                                 
      18                 :      */                                                             
      19               1 :     class TrackHeader implements Chunk {                            
      20                 :                                                                     
      21                 :         /**                                                         
      22                 :          * @var int                                                 
      23                 :          */                                                         
      24                 :         protected $size;                                            
      25                 :                                                                     
      26                 :         /**                                                         
      27                 :          * The length of a MIDI track header in bytes               
      28                 :          *                                                          
      29                 :          * @var int                                                 
      30                 :          */                                                         
      31                 :         const LENGTH = 8;                                           
      32                 :                                                                     
      33                 :         /**                                                         
      34                 :          * Constructor                                              
      35                 :          *                                                          
      36                 :          * @since 1.0                                               
      37                 :          *                                                          
      38                 :          * @param  int $size The size of the track in bytes         
      39                 :          */                                                         
      40                 :         public function __construct($size) {                        
      41               6 :             $this->size = $size;                                    
      42               6 :         }                                                           
      43                 :                                                                     
      44                 :         /**                                                         
      45                 :          * Gets the size of the track in bytes                      
      46                 :          *                                                          
      47                 :          * @since 1.0                                               
      48                 :          * @todo  Get rid of this and use getData() instead         
      49                 :          *                                                          
      50                 :          * @return int                                              
      51                 :          */                                                         
      52                 :         public function getSize() {                                 
      53               2 :             return $this->size;                                     
      54                 :         }                                                           
      55                 :                                                                     
      56                 :         /**                                                         
      57                 :          * @since 1.0                                               
      58                 :          *                                                          
      59                 :          * @return int                                              
      60                 :          */                                                         
      61                 :         public function getLength() {                               
      62               1 :             return self::LENGTH;                                    
      63                 :         }                                                           
      64                 :                                                                     
      65                 :         /**                                                         
      66                 :          * @since 1.0                                               
      67                 :          *                                                          
      68                 :          * @return array                                            
      69                 :          */                                                         
      70                 :         public function getData() {                                 
      71               1 :             return array($this->size);                              
      72                 :         }                                                           
      73                 :                                                                     
      74                 :         /**                                                         
      75                 :          * @since 1.0                                               
      76                 :          * @uses  Util::pack()                                      
      77                 :          *                                                          
      78                 :          * @return binary                                           
      79                 :          */                                                         
      80                 :         public function toBinary() {                                
      81                 :             return                                                  
      82               1 :                 Util\Util::pack(0x4D, 0x54, 0x72, 0x6B) .           
      83               1 :                 Util\Util::pack($this->size >> 24) .                
      84               1 :                 Util\Util::pack(($this->size >> 16) & 0xFF) .       
      85               1 :                 Util\Util::pack(($this->size >> 8) & 0xFF) .        
      86               1 :                 Util\Util::pack($this->size & 0xFF);                
      87                 :         }                                                           
      88                 :                                                                     
      89                 :         /**                                                         
      90                 :          * @since 1.0                                               
      91                 :          *                                                          
      92                 :          * @return string                                           
      93                 :          */                                                         
      94                 :         public function __toString() {                              
      95               1 :             return 'Track (' . $this->size . ' bytes)';             
      96                 :         }                                                           
      97                 :                                                                     
      98                 :     }                                                               
      99                 :                                                                     

Generated by PHPUnit 3.4.1 and Xdebug 2.0.5 using PHP 5.3.0 at Sun Oct 25 23:35:09 PDT 2009.