[Pkg-owncloud-commits] [php-sabre-vobject] 23/43: test using dataProvider
David Prévot
taffit at moszumanska.debian.org
Fri Oct 10 14:16:16 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 45bec1fae0b56c4e021be91decd213365c4abd52
Author: Dominik Tobschall <dominik at fruux.com>
Date: Tue Sep 30 13:47:38 2014 +0200
test using dataProvider
---
tests/VObject/TimeZoneUtilTest.php | 56 ++++++++++++++++++++++++++++----------
1 file changed, 42 insertions(+), 14 deletions(-)
diff --git a/tests/VObject/TimeZoneUtilTest.php b/tests/VObject/TimeZoneUtilTest.php
index 3a076b2..6526ed4 100644
--- a/tests/VObject/TimeZoneUtilTest.php
+++ b/tests/VObject/TimeZoneUtilTest.php
@@ -151,30 +151,58 @@ HI;
}
- function testPHPTimeZoneIdentifiers() {
-
- $tzIdentifiers = \DateTimeZone::listIdentifiers();
+ /**
+ * @dataProvider getPHPTimeZoneIdentifiers
+ */
+ function testTimeZoneIdentifiers($tzid) {
- foreach ($tzIdentifiers as $tzid) {
- $tz = TimeZoneUtil::getTimeZone($tzid);
- $ex = new \DateTimeZone($tzid);
+ $tz = TimeZoneUtil::getTimeZone($tzid);
+ $ex = new \DateTimeZone($tzid);
- $this->assertEquals($ex->getName(), $tz->getName());
- }
+ $this->assertEquals($ex->getName(), $tz->getName());
}
- function testPHPBCTimeZoneIdentifiers() {
+ /**
+ * @dataProvider getPHPTimeZoneBCIdentifiers
+ */
+ function testTimeZoneBCIdentifiers($tzid) {
- $tzIdentifiers = TimeZoneUtil::getIdentifiersBC();
+ $tz = TimeZoneUtil::getTimeZone($tzid);
+ $ex = new \DateTimeZone($tzid);
- foreach ($tzIdentifiers as $tzid) {
- $tz = TimeZoneUtil::getTimeZone($tzid);
- $ex = new \DateTimeZone($tzid);
+ $this->assertEquals($ex->getName(), $tz->getName());
+
+ }
+
+ function getPHPTimeZoneIdentifiers() {
- $this->assertEquals($ex->getName(), $tz->getName());
+ $tzIdentifiers = \DateTimeZone::listIdentifiers();
+
+ $tzids = array();
+ foreach($tzIdentifiers as $key => $tzid) {
+ $tzids[] = $tzid;
}
+ // PHPUNit requires an array of arrays
+ return array_map(
+ function($value) {
+ return array($value);
+ },
+ $tzids
+ );
+ }
+
+ function getPHPTimeZoneBCIdentifiers() {
+
+ // PHPUNit requires an array of arrays
+ return array_map(
+ function($value) {
+ return array($value);
+ },
+ TimeZoneUtil::getIdentifiersBC()
+ );
+
}
function testTimezoneOffset() {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list