Include composer dependencies in repo
This commit is contained in:
26
vendor/eluceo/ical/tests/Eluceo/iCal/Property/ArrayValueTest.php
vendored
Normal file
26
vendor/eluceo/ical/tests/Eluceo/iCal/Property/ArrayValueTest.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Eluceo\iCal\Property;
|
||||
|
||||
class ArrayValueTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider arrayValuesProvider
|
||||
*/
|
||||
public function testArrayValue($values, $expectedOutput)
|
||||
{
|
||||
$arrayValue = new ArrayValue($values);
|
||||
|
||||
$this->assertEquals($expectedOutput, $arrayValue->getEscapedValue());
|
||||
}
|
||||
|
||||
public function arrayValuesProvider()
|
||||
{
|
||||
return array(
|
||||
array(array(), ''),
|
||||
array(array('Lorem'), 'Lorem'),
|
||||
array(array('Lorem', 'Ipsum'), 'Lorem,Ipsum'),
|
||||
array(array('Lorem', '"doublequotes"'), 'Lorem,\"doublequotes\"'),
|
||||
);
|
||||
}
|
||||
}
|
||||
17
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/DescriptionTest.php
vendored
Normal file
17
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/DescriptionTest.php
vendored
Normal 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()
|
||||
);
|
||||
}
|
||||
}
|
||||
63
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/OrganizerTest.php
vendored
Normal file
63
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/OrganizerTest.php
vendored
Normal 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;
|
||||
}
|
||||
}
|
||||
21
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php
vendored
Normal file
21
vendor/eluceo/ical/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php
vendored
Normal 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()
|
||||
);
|
||||
}
|
||||
}
|
||||
63
vendor/eluceo/ical/tests/Eluceo/iCal/Property/StringValueTest.php
vendored
Normal file
63
vendor/eluceo/ical/tests/Eluceo/iCal/Property/StringValueTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Eluceo\iCal\Property;
|
||||
|
||||
use Eluceo\iCal\Property\StringValue;
|
||||
|
||||
class StringValueTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNoEscapeNeeded()
|
||||
{
|
||||
$stringValue = new StringValue('LOREM');
|
||||
|
||||
$this->assertEquals(
|
||||
'LOREM',
|
||||
$stringValue->getEscapedValue(),
|
||||
'No escaping necessary'
|
||||
);
|
||||
}
|
||||
|
||||
public function testValueContainsBackslash()
|
||||
{
|
||||
$stringValue = new StringValue('text contains backslash: \\');
|
||||
|
||||
$this->assertEquals(
|
||||
'text contains backslash: \\\\',
|
||||
$stringValue->getEscapedValue(),
|
||||
'Text contains backslash'
|
||||
);
|
||||
}
|
||||
|
||||
public function testEscapingDoubleQuotes()
|
||||
{
|
||||
$stringValue = new StringValue('text with "doublequotes" will be escaped');
|
||||
|
||||
$this->assertEquals(
|
||||
'text with \\"doublequotes\\" will be escaped',
|
||||
$stringValue->getEscapedValue(),
|
||||
'Escaping double quotes'
|
||||
);
|
||||
}
|
||||
|
||||
public function testEscapingSemicolonAndComma()
|
||||
{
|
||||
$stringValue = new StringValue('text with , and ; will also be escaped');
|
||||
|
||||
$this->assertEquals(
|
||||
'text with \\, and \\; will also be escaped',
|
||||
$stringValue->getEscapedValue(),
|
||||
'Escaping ; and ,'
|
||||
);
|
||||
}
|
||||
|
||||
public function testNewLineEscaping()
|
||||
{
|
||||
$stringValue = new StringValue("Text with new\n line");
|
||||
|
||||
$this->assertEquals(
|
||||
'Text with new\\n line',
|
||||
$stringValue->getEscapedValue(),
|
||||
'Escape new line to text'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user