File: myCalendarTest.php

package info (click to toggle)
awl 0.64-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 884 kB
  • sloc: php: 6,291; sql: 109; sh: 70; makefile: 55
file content (84 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
 * Created by JetBrains PhpStorm.
 * User: milan
 * Date: 7/12/13
 * Time: 8:57 AM
 * To change this template use File | Settings | File Templates.
 */

require_once('inc/vCalendar.php');

// compatibility with phpunit 6
if (!class_exists('\PHPUnit_Framework_TestCase') &&
    class_exists('\PHPUnit\Framework\TestCase')) {
    class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
}

class myCalendarTest extends PHPUnit_Framework_TestCase {

    function getData($filename){
        $file = fopen($filename, 'r');
        $data = fread($file, filesize($filename));
        fclose($file);
        return $data;
    }

    function test1(){


        $mycalendar = new vCalendar($this->getData('tests/data/0000-Setup-PUT-collection.test'));
        $test = $mycalendar->Render();

        $timezones = $mycalendar->GetComponents('VTIMEZONE',true);
        $components = $mycalendar->GetComponents('VTIMEZONE',false);


        $resources = array();
        foreach($components as $comp){

            $uid = $comp->GetPValue('UID');
            $resources[$uid][] = $comp;


        }

        foreach($resources as $key => $res){
            $testcal = new vCalendar();
            $testcal->SetComponents($res);
            $t = $testcal->Render();
            $t = $testcal->Render();
        }

        $mycalendar->Render();
    }


    function test2(){

        $data = explode("\n",$this->getData('tests/data/0244-MOZ-POST-FB.test'));

        $data = implode("\r\n", $data);

        $mycalendar = new vCalendar($data);
//        foreach($mycalendar->GetComponents() as $comp){
//            $next = $comp->GetComponents();
//            if(isset($next)){
//                foreach($next as $comp2){
//                    $comp2->GetComponents();
//                    $comp2->GetProperties();
//                }
//            }
//
//            $comp->GetProperties();
//        }
        //$test = $mycalendar->Render();
        $property = $mycalendar->GetProperties()[0];
        $value = $property->Value();
        $name = $property->Name();


        $this->assertStringEndsNotWith("\r", $value);
    }

}