diff options
Diffstat (limited to 'vendor/sabre/vobject/tests/Sabre/VObject/Property')
3 files changed, 0 insertions, 507 deletions
diff --git a/vendor/sabre/vobject/tests/Sabre/VObject/Property/CompoundTest.php b/vendor/sabre/vobject/tests/Sabre/VObject/Property/CompoundTest.php deleted file mode 100644 index 5d8cdaabb..000000000 --- a/vendor/sabre/vobject/tests/Sabre/VObject/Property/CompoundTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Sabre\VObject\Property; -use Sabre\VObject\Component; - -class CompoundTest extends \PHPUnit_Framework_TestCase { - - function testSetParts() { - - $arr = array( - 'ABC, Inc.', - 'North American Division', - 'Marketing;Sales', - ); - - $elem = new Compound('ORG'); - $elem->setParts($arr); - - $this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $elem->value); - $this->assertEquals(3, count($elem->getParts())); - $parts = $elem->getParts(); - $this->assertEquals('Marketing;Sales', $parts[2]); - - } - - function testGetParts() { - - $str = 'ABC\, Inc.;North American Division;Marketing\;Sales'; - - $elem = new Compound('ORG', $str); - - $this->assertEquals(3, count($elem->getParts())); - $parts = $elem->getParts(); - $this->assertEquals('Marketing;Sales', $parts[2]); - } - - function testGetPartsDefaultDelimiter() { - - $str = 'Hi!;Hello!'; - - $elem = new Compound('X-FOO', $str); - - $this->assertEquals(array( - 'Hi!', - 'Hello!', - ), $elem->getParts()); - - } - - function testGetPartsNull() { - - $str = 'ABC\, Inc.;North American Division;Marketing\;Sales'; - - $elem = new Compound('ORG', null); - - $this->assertEquals(0, count($elem->getParts())); - - } -} diff --git a/vendor/sabre/vobject/tests/Sabre/VObject/Property/DateTimeTest.php b/vendor/sabre/vobject/tests/Sabre/VObject/Property/DateTimeTest.php deleted file mode 100644 index b5b522e7d..000000000 --- a/vendor/sabre/vobject/tests/Sabre/VObject/Property/DateTimeTest.php +++ /dev/null @@ -1,240 +0,0 @@ -<?php - -namespace Sabre\VObject\Property; -use Sabre\VObject\Component; - -class DateTimeTest extends \PHPUnit_Framework_TestCase { - - function testSetDateTime() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - - } - - function testSetDateTimeLOCAL() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt, DateTime::LOCAL); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeUTC() { - - $tz = new \DateTimeZone('GMT'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt, DateTime::UTC); - - $this->assertEquals('19850704T013000Z', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeLOCALTZ() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt, DateTime::LOCALTZ); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeDATE() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt, DateTime::DATE); - - $this->assertEquals('19850704', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE', (string)$elem['VALUE']); - - $this->assertFalse($elem->hasTime()); - } - - /** - * @expectedException InvalidArgumentException - */ - function testSetDateTimeInvalid() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt, 7); - - } - - function testGetDateTimeCached() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new DateTime('DTSTART'); - $elem->setDateTime($dt); - - $this->assertEquals($elem->getDateTime(), $dt); - - } - - function testGetDateTimeDateNULL() { - - $elem = new DateTime('DTSTART'); - $dt = $elem->getDateTime(); - - $this->assertNull($dt); - $this->assertNull($elem->getDateType()); - - } - - function testGetDateTimeDateDATE() { - - $elem = new DateTime('DTSTART','19850704'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 00:00:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(DateTime::DATE, $elem->getDateType()); - - } - - - function testGetDateTimeDateLOCAL() { - - $elem = new DateTime('DTSTART','19850704T013000'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(DateTime::LOCAL, $elem->getDateType()); - - } - - function testGetDateTimeDateUTC() { - - $elem = new DateTime('DTSTART','19850704T013000Z'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('UTC', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::UTC, $elem->getDateType()); - - } - - function testGetDateTimeDateLOCALTZ() { - - $elem = new DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Europe/Amsterdam'; - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testGetDateTimeDateInvalid() { - - $elem = new DateTime('DTSTART','bla'); - $dt = $elem->getDateTime(); - - } - - function testGetDateTimeWeirdTZ() { - - $elem = new DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; - - - $event = new Component('VEVENT'); - $event->add($elem); - - $timezone = new Component('VTIMEZONE'); - $timezone->TZID = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; - $timezone->{'X-LIC-LOCATION'} = 'Europe/Amsterdam'; - - $calendar = new Component('VCALENDAR'); - $calendar->add($event); - $calendar->add($timezone); - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); - - } - - function testGetDateTimeBadTimeZone() { - - $default = date_default_timezone_get(); - date_default_timezone_set('Canada/Eastern'); - - $elem = new DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Moon'; - - - $event = new Component('VEVENT'); - $event->add($elem); - - $timezone = new Component('VTIMEZONE'); - $timezone->TZID = 'Moon'; - $timezone->{'X-LIC-LOCATION'} = 'Moon'; - - $calendar = new Component('VCALENDAR'); - $calendar->add($event); - $calendar->add($timezone); - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Canada/Eastern', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); - date_default_timezone_set($default); - - } -} diff --git a/vendor/sabre/vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php b/vendor/sabre/vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php deleted file mode 100644 index 177616652..000000000 --- a/vendor/sabre/vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php +++ /dev/null @@ -1,208 +0,0 @@ -<?php - -namespace Sabre\VObject\Property; - -class MultiDateTimeTest extends \PHPUnit_Framework_TestCase { - - function testSetDateTime() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2)); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - - } - - function testSetDateTimeLOCAL() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), DateTime::LOCAL); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeUTC() { - - $tz = new \DateTimeZone('GMT'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), DateTime::UTC); - - $this->assertEquals('19850704T013000Z,19860704T013000Z', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeLOCALTZ() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), DateTime::LOCALTZ); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - $this->assertTrue($elem->hasTime()); - } - - function testSetDateTimeDATE() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->settimezone($tz); - $dt2->settimezone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), DateTime::DATE); - - $this->assertEquals('19850704,19860704', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE', (string)$elem['VALUE']); - - $this->assertFalse($elem->hasTime()); - } - - /** - * @expectedException InvalidArgumentException - */ - function testSetDateTimeInvalid() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt = new \DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt), 7); - - } - - function testGetDateTimeCached() { - - $tz = new \DateTimeZone('Europe/Amsterdam'); - $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); - $dt1->settimezone($tz); - $dt2->settimezone($tz); - - $elem = new MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2)); - - $this->assertEquals($elem->getDateTimes(), array($dt1,$dt2)); - - } - - function testGetDateTimeDateNULL() { - - $elem = new MultiDateTime('DTSTART'); - $dt = $elem->getDateTimes(); - - $this->assertNull($dt); - $this->assertNull($elem->getDateType()); - - } - - function testGetDateTimeDateDATE() { - - $elem = new MultiDateTime('DTSTART','19850704,19860704'); - $dt = $elem->getDateTimes(); - - $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); - $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); - $this->assertEquals(DateTime::DATE, $elem->getDateType()); - - } - - function testGetDateTimeDateDATEReverse() { - - $elem = new MultiDateTime('DTSTART','19850704,19860704'); - - $this->assertEquals(DateTime::DATE, $elem->getDateType()); - - $dt = $elem->getDateTimes(); - $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); - $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); - - } - - - function testGetDateTimeDateLOCAL() { - - $elem = new DateTime('DTSTART','19850704T013000'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(DateTime::LOCAL, $elem->getDateType()); - - } - - function testGetDateTimeDateUTC() { - - $elem = new DateTime('DTSTART','19850704T013000Z'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('UTC', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::UTC, $elem->getDateType()); - - } - - function testGetDateTimeDateLOCALTZ() { - - $elem = new DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Europe/Amsterdam'; - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testGetDateTimeDateInvalid() { - - $elem = new DateTime('DTSTART','bla'); - $dt = $elem->getDateTime(); - - } - -} |