From dd6a4b1aa10bd8d7ab9abee46cd0c527ca8ebe21 Mon Sep 17 00:00:00 2001 From: upper Date: Sat, 28 Oct 2017 22:09:41 +0100 Subject: [PATCH 1/3] Add license date range unit test --- test/unit/SendGridTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/unit/SendGridTest.php b/test/unit/SendGridTest.php index 15abff83e..7dd5e8770 100644 --- a/test/unit/SendGridTest.php +++ b/test/unit/SendGridTest.php @@ -1052,6 +1052,12 @@ public function test_ips__ip_address__get() $this->assertEquals($response->statusCode(), 200); } + public function test_license_date_range() + { + $license_file = file_get_contents("../../LICENSE.txt"); + $this-> assertInternalType("int", strpos($license_file, date("Y"))); + } + public function test_mail_batch_post() { $request_headers = array("X-Mock: 201"); From 2f9582dc9f8dfd9cce86361ee0e7d79be75bcf67 Mon Sep 17 00:00:00 2001 From: upper Date: Sat, 28 Oct 2017 23:03:09 +0100 Subject: [PATCH 2/3] Remove unneeded space --- test/unit/SendGridTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/SendGridTest.php b/test/unit/SendGridTest.php index 7dd5e8770..92ef20059 100644 --- a/test/unit/SendGridTest.php +++ b/test/unit/SendGridTest.php @@ -1055,7 +1055,7 @@ public function test_ips__ip_address__get() public function test_license_date_range() { $license_file = file_get_contents("../../LICENSE.txt"); - $this-> assertInternalType("int", strpos($license_file, date("Y"))); + $this->assertInternalType("int", strpos($license_file, date("Y"))); } public function test_mail_batch_post() From 6773562f05631f525fad96d1cc1f6beb229726e6 Mon Sep 17 00:00:00 2001 From: uppe-r <12294525+uppe-r@users.noreply.github.com> Date: Mon, 30 Oct 2017 12:29:44 +0000 Subject: [PATCH 3/3] Improve copyright line detection --- test/unit/SendGridTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/SendGridTest.php b/test/unit/SendGridTest.php index 92ef20059..6ecd24f09 100644 --- a/test/unit/SendGridTest.php +++ b/test/unit/SendGridTest.php @@ -1055,7 +1055,8 @@ public function test_ips__ip_address__get() public function test_license_date_range() { $license_file = file_get_contents("../../LICENSE.txt"); - $this->assertInternalType("int", strpos($license_file, date("Y"))); + $current_year = date("Y"); + $this->assertInternalType("int", strpos($license_file, "Copyright (c) 2012-" . $current_year . " SendGrid, Inc.")); } public function test_mail_batch_post()