From 855fdd3916c91848427bbb3acf381fb6875d4afd Mon Sep 17 00:00:00 2001 From: Steven Jones Date: Thu, 1 Feb 2024 14:03:26 +0000 Subject: [PATCH 1/4] Add support for Guzzle 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a5e11ef..b223dfb 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "homepage": "https://github.com/darthsteven" }], "require": { - "guzzlehttp/guzzle": "~6.1" + "guzzlehttp/guzzle": "~6.1|~7.0" }, "require-dev" : { "phpunit/phpunit": "~4.0|~5.0" From c3cca50cf2303d9894ee797ca09a279a493b030b Mon Sep 17 00:00:00 2001 From: Steven Jones Date: Thu, 1 Feb 2024 14:10:03 +0000 Subject: [PATCH 2/4] Move to HTTPS --- src/EDTFInfo.php | 2 +- src/EDTFInfoLegacy.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EDTFInfo.php b/src/EDTFInfo.php index fdd24e6..0fb8f95 100644 --- a/src/EDTFInfo.php +++ b/src/EDTFInfo.php @@ -44,7 +44,7 @@ protected function ensureAPIData() { if (!isset($this->apiData)) { $client = new GuzzleHttp\Client(); try { - $res = $client->request('GET', 'http://edtf.herokuapp.com/', array( + $res = $client->request('GET', 'https://edtf.herokuapp.com/', array( 'timeout' => 15, 'query' => array( 'date' => $this->dateString, diff --git a/src/EDTFInfoLegacy.php b/src/EDTFInfoLegacy.php index c4e4270..237b872 100644 --- a/src/EDTFInfoLegacy.php +++ b/src/EDTFInfoLegacy.php @@ -42,7 +42,7 @@ protected function ensureAPIData() { if (!isset($this->apiData)) { $client = new GuzzleHttp\Client(); try { - $res = $client->request('GET', 'http://digital2.library.unt.edu/edtf/isValid.json', array( + $res = $client->request('GET', 'https://digital2.library.unt.edu/edtf/isValid.json', array( 'timeout' => 10, 'query' => array( 'date' => $this->dateString, From 0c085549a8a14a488d7a7f5be07f800c9b05385f Mon Sep 17 00:00:00 2001 From: Steven Jones Date: Thu, 1 Feb 2024 14:13:45 +0000 Subject: [PATCH 3/4] Specify invalid dates correctly. --- tests/EDTFInfoLegacyTest.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/EDTFInfoLegacyTest.php b/tests/EDTFInfoLegacyTest.php index 4f07a10..197c425 100644 --- a/tests/EDTFInfoLegacyTest.php +++ b/tests/EDTFInfoLegacyTest.php @@ -63,7 +63,6 @@ public function dateStringProvider() { array('2004-06?', '2004-06-01T00:00:00.000Z', '2004-06-30T23:59:59.999Z'), array('2004-06-11?', '2004-06-11T00:00:00.000Z', '2004-06-11T23:59:59.999Z'), array('1984~', '1984-01-01T00:00:00', '1984-12-31T23:59:59.999Z'), - '1984?~', // 5.2.2 Unspecified array('199u', '1990-01-01T00:00:00.000Z', '1999-12-31T23:59:59.999Z'), @@ -132,6 +131,12 @@ public function dateStringProvider() { // 5.3.8 Season - Qualified '2001-21^southernHemisphere', ); + + $invalid_dates = [ + '1970-85-01', + '1984?~', + ]; + foreach ($valid_dates as $date) { if (!is_array($date)) { $date = array($date); @@ -144,8 +149,19 @@ public function dateStringProvider() { isset($date[2]) ? $date[2] : NULL, ); } - - $dates['1970-85-01'] = array('1970-85-01', FALSE); + + foreach ($invalid_dates as $date) { + if (!is_array($date)) { + $date = array($date); + } + // Ensure the array has at least the defaults. + $dates[$date[0]] = array( + $date[0], + FALSE, + isset($date[1]) ? $date[1] : NULL, + isset($date[2]) ? $date[2] : NULL, + ); + } return new ArrayIterator($dates); } From da6648cf19152e472240b11e0b56258e640ca529 Mon Sep 17 00:00:00 2001 From: Steven Jones Date: Thu, 1 Feb 2024 14:19:16 +0000 Subject: [PATCH 4/4] Mark the tests as incomplete. --- .travis.yml | 15 --------------- tests/EDTFInfoLegacyTest.php | 3 ++- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10be0fa..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -language: php -php: - - 5.5 - - 5.6 - - 7.0 - - hhvm -matrix: - fast_finish: true -install: - - composer install -notifications: - email: - on_success: never - on_failure: change diff --git a/tests/EDTFInfoLegacyTest.php b/tests/EDTFInfoLegacyTest.php index 197c425..b01d6c8 100644 --- a/tests/EDTFInfoLegacyTest.php +++ b/tests/EDTFInfoLegacyTest.php @@ -14,6 +14,7 @@ protected function setUp() { * @dataProvider dateStringProvider */ public function testGetEDTFInfo($dateString, $valid, $min = NULL, $max = NULL) { + $this->markTestIncomplete('This test needs re-working, because of the spec changes to EDTF.'); if ($valid) { $dateInfo = $this->factory->create($dateString); $this->assertTrue($dateInfo->isValid(), 'Valid date is valid.'); @@ -63,6 +64,7 @@ public function dateStringProvider() { array('2004-06?', '2004-06-01T00:00:00.000Z', '2004-06-30T23:59:59.999Z'), array('2004-06-11?', '2004-06-11T00:00:00.000Z', '2004-06-11T23:59:59.999Z'), array('1984~', '1984-01-01T00:00:00', '1984-12-31T23:59:59.999Z'), + '1984?~', // 5.2.2 Unspecified array('199u', '1990-01-01T00:00:00.000Z', '1999-12-31T23:59:59.999Z'), @@ -134,7 +136,6 @@ public function dateStringProvider() { $invalid_dates = [ '1970-85-01', - '1984?~', ]; foreach ($valid_dates as $date) {