Include composer dependencies in repo

This commit is contained in:
Frederic Guillot
2017-10-25 16:22:10 -07:00
parent c507c54162
commit 9e2b2a32fd
1787 changed files with 123616 additions and 45 deletions

View File

@@ -0,0 +1,17 @@
<?php
namespace Eluceo\iCal\Property\Event;
class DescriptionTest extends \PHPUnit_Framework_TestCase
{
public function testAllowsNewLines()
{
$testString = "New String \n New Line";
$description = new Description($testString);
$this->assertEquals(
str_replace("\n", "\\n", $testString),
$description->getEscapedValue()
);
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* Eluceo\iCal\Property\Event\OrganizerTest
*
* @author Giulio Troccoli <giulio@troccoli.it>
*/
namespace Eluceo\iCal\Property\Event;
/**
* OrganizerTest
*/
class OrganizerTest extends \PHPUnit_Framework_TestCase
{
public function testOrganizerValueOnly()
{
$value = "MAILTO:name.lastname@example.com";
$expected = "ORGANIZER:$value";
$vCalendar = $this->createCalendarWithOrganizer(
new \Eluceo\iCal\Property\Event\Organizer($value)
);
foreach (explode("\n", $vCalendar->render()) as $line)
{
if (preg_match('/^ORGANIZER[:;](.*)$/', $line)) {
$this->assertEquals($expected, trim($line));
}
}
}
public function testOrganizerValueAndParameter()
{
$value = "MAILTO:name.lastname@example.com";
$param = "Name LastName";
$expected = "ORGANIZER;CN=$param:$value";
$vCalendar = $this->createCalendarWithOrganizer(
new \Eluceo\iCal\Property\Event\Organizer($value, array('CN' => $param))
);
foreach (explode("\n", $vCalendar->render()) as $line)
{
if (preg_match('/^ORGANIZER[:;](.*)$/', $line)) {
$this->assertEquals($expected, trim($line));
}
}
}
/**
* @param Organizer $vOrganizer
* @return \Eluceo\iCal\Component\Calendar
*/
private function createCalendarWithOrganizer(\Eluceo\iCal\Property\Event\Organizer $vOrganizer)
{
$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
$vEvent = new \Eluceo\iCal\Component\Event('123456');
$vEvent->setOrganizer($vOrganizer);
$vCalendar->addComponent($vEvent);
return $vCalendar;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Eluceo\iCal\Property\Event;
class RecurrenceRuleTest extends \PHPUnit_Framework_TestCase
{
/**
* Example taken from http://www.kanzaki.com/docs/ical/rrule.html
*/
public function testUntil()
{
$rule = new RecurrenceRule();
$rule->setFreq(RecurrenceRule::FREQ_DAILY);
$rule->setInterval(null);
$rule->setUntil(new \DateTime('1997-12-24'));
$this->assertEquals(
'FREQ=DAILY;UNTIL=19971224T000000Z',
$rule->getEscapedValue()
);
}
}