Handle htmlspecialchars() differences between PHP < 5.4 vs >= 5.4
[awl.git] / tests / myCalendarTest.php
blob6bc712720457548afd86bba567362684b907ea5f
1 <?php
2 /**
3 * Created by JetBrains PhpStorm.
4 * User: milan
5 * Date: 7/12/13
6 * Time: 8:57 AM
7 * To change this template use File | Settings | File Templates.
8 */
10 require_once('inc/vCalendar.php');
12 class myCalendarTest extends PHPUnit_Framework_TestCase {
14 function getData($filename){
15 $file = fopen($filename, 'r');
16 $data = fread($file, filesize($filename));
17 fclose($file);
18 return $data;
21 function test1(){
24 $mycalendar = new vCalendar($this->getData('tests/data/0000-Setup-PUT-collection.test'));
25 $test = $mycalendar->Render();
27 $timezones = $mycalendar->GetComponents('VTIMEZONE',true);
28 $components = $mycalendar->GetComponents('VTIMEZONE',false);
31 $resources = array();
32 foreach($components as $comp){
34 $uid = $comp->GetPValue('UID');
35 $resources[$uid][] = $comp;
40 foreach($resources as $key => $res){
41 $testcal = new vCalendar();
42 $testcal->SetComponents($res);
43 $t = $testcal->Render();
44 $t = $testcal->Render();
47 $mycalendar->Render();
51 function test2(){
53 $data = explode("\n",$this->getData('tests/data/0244-MOZ-POST-FB.test'));
55 $data = implode($data, "\r\n");
57 $mycalendar = new vCalendar($data);
58 // foreach($mycalendar->GetComponents() as $comp){
59 // $next = $comp->GetComponents();
60 // if(isset($next)){
61 // foreach($next as $comp2){
62 // $comp2->GetComponents();
63 // $comp2->GetProperties();
64 // }
65 // }
67 // $comp->GetProperties();
68 // }
69 //$test = $mycalendar->Render();
70 $property = $mycalendar->GetProperties()[0];
71 $value = $property->Value();
72 $name = $property->Name();
75 $this->assertStringEndsNotWith("\r", $value);