Tests Split class pass.
[order_line_extra.git] / tests / splitTest.php
1 <?php
2 global $path_to_root;
3 $path_to_root = '../../';
4 require_once('includes/splitter.inc');
5
6 /* Stubbing undefined function */
7 global $dateformats, $dateseps;
8         $dateformats    = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD","MmmDDYYYY", "DDMmmYYYY", "YYYYMmmDD");
9         $dateseps               = array("/", ".", "-", " ");
10 function user_date_format() {
11         return 2; // YYYMMDD
12 }
13
14 function user_date_sep() {
15         return 0;
16 }
17
18 class splitTest extends PHPUnit_Framework_TestCase {
19         public function testConstructor() {
20                 $date = '2013/01/05';
21                 $split = new Split($date);
22         
23                 $this->assertEquals($split->start_date, $date);
24                 $this->assertEquals($split->end_date, $date);
25                 
26                 return $split;
27         }
28
29         /**
30          *  @depends testConstructor
31          */
32         public function testExtend($split) {
33                 $split->extend(10);
34                 $this->assertEquals($split->end_date, '2013/01/15');
35         }
36 }
37 ?>