-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert tests to PSR-2 coding standards
- Loading branch information
Showing
15 changed files
with
1,268 additions
and
920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Kristof | ||
* Date: 12/12/13 | ||
* Time: 20:31 | ||
*/ | ||
|
||
class CultureFeed_Cdb_Data_Calendar_PeriodTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function testAppendToDOM() { | ||
$from = '2013-12-06'; | ||
$to = '2013-12-25'; | ||
$period = new CultureFeed_Cdb_Data_Calendar_Period($from, $to); | ||
|
||
$scheme = new CultureFeed_Cdb_Data_Calendar_Weekscheme(); | ||
|
||
$scheme->monday()->setOpen(); | ||
$scheme->tuesday()->setOpen(); | ||
$scheme->wednesday()->setOpen(); | ||
$scheme->thursday()->setOpenByAppointment(); | ||
$scheme->friday()->setOpen(); | ||
$scheme->saturday()->setClosed(); | ||
$scheme->sunday()->setClosed(); | ||
|
||
$period->setWeekScheme($scheme); | ||
|
||
$dom = new DOMDocument('1.0', 'utf8'); | ||
$root = $dom->createElement('calendar'); | ||
$dom->appendChild($root); | ||
|
||
$period->appendToDOM($root); | ||
|
||
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/samples/period.xml', $dom->saveXML()); | ||
} | ||
class CultureFeed_Cdb_Data_Calendar_PeriodTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testAppendToDOM() | ||
{ | ||
$from = '2013-12-06'; | ||
$to = '2013-12-25'; | ||
$period = new CultureFeed_Cdb_Data_Calendar_Period($from, $to); | ||
|
||
$scheme = new CultureFeed_Cdb_Data_Calendar_Weekscheme(); | ||
|
||
$scheme->monday()->setOpen(); | ||
$scheme->tuesday()->setOpen(); | ||
$scheme->wednesday()->setOpen(); | ||
$scheme->thursday()->setOpenByAppointment(); | ||
$scheme->friday()->setOpen(); | ||
$scheme->saturday()->setClosed(); | ||
$scheme->sunday()->setClosed(); | ||
|
||
$period->setWeekScheme($scheme); | ||
|
||
$dom = new DOMDocument('1.0', 'utf8'); | ||
$root = $dom->createElement('calendar'); | ||
$dom->appendChild($root); | ||
|
||
$period->appendToDOM($root); | ||
|
||
$this->assertXmlStringEqualsXmlFile( | ||
__DIR__ . '/samples/period.xml', | ||
$dom->saveXML() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Kristof | ||
* Date: 12/12/13 | ||
* Time: 19:46 | ||
*/ | ||
|
||
class CultureFeed_Cdb_Data_Calendar_WeekschemeTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function testAppendToDOM() { | ||
$open = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_OPEN; | ||
$closed = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_CLOSED; | ||
|
||
$ws = new CultureFeed_Cdb_Data_Calendar_Weekscheme(); | ||
|
||
/** @var CultureFeed_Cdb_Data_Calendar_SchemeDay[] $days */ | ||
$days = array(); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::MONDAY, $closed); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::TUESDAY, $open); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::WEDNESDAY, $open); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::THURSDAY, $closed); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::FRIDAY, $open); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::SATURDAY, $open); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay(CultureFeed_Cdb_Data_Calendar_SchemeDay::SUNDAY, $closed); | ||
|
||
foreach ($days as $day) { | ||
$ws->setDay($day->getDayName(), $day); | ||
*/ | ||
class CultureFeed_Cdb_Data_Calendar_WeekschemeTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testAppendToDOM() | ||
{ | ||
$open = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_OPEN; | ||
$closed = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_CLOSED; | ||
|
||
$ws = new CultureFeed_Cdb_Data_Calendar_Weekscheme(); | ||
|
||
/** @var CultureFeed_Cdb_Data_Calendar_SchemeDay[] $days */ | ||
$days = array(); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::MONDAY, | ||
$closed | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::TUESDAY, | ||
$open | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::WEDNESDAY, | ||
$open | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::THURSDAY, | ||
$closed | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::FRIDAY, | ||
$open | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::SATURDAY, | ||
$open | ||
); | ||
$days[] = new CultureFeed_Cdb_Data_Calendar_SchemeDay( | ||
CultureFeed_Cdb_Data_Calendar_SchemeDay::SUNDAY, | ||
$closed | ||
); | ||
|
||
foreach ($days as $day) { | ||
$ws->setDay($day->getDayName(), $day); | ||
} | ||
|
||
$dom = new DOMDocument('1.0', 'utf8'); | ||
$root = $dom->createElement('period'); | ||
$dom->appendChild($root); | ||
$ws->appendToDOM($root); | ||
|
||
$this->assertXmlStringEqualsXmlFile( | ||
__DIR__ . '/samples/weekscheme.xml', | ||
$dom->saveXML() | ||
); | ||
} | ||
|
||
$dom = new DOMDocument('1.0', 'utf8'); | ||
$root = $dom->createElement('period'); | ||
$dom->appendChild($root); | ||
$ws->appendToDOM($root); | ||
|
||
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/samples/weekscheme.xml', $dom->saveXML()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.