Changeset 2373992
- Timestamp:
- 09/02/2020 03:16:52 PM (6 years ago)
- Location:
- sparkpost/trunk
- Files:
-
- 6 edited
-
.travis.yml (modified) (2 diffs)
-
mailer.http.class.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
-
tests/bin/install-wp-tests.sh (modified) (1 diff)
-
tests/specs/test-mailer.http.class.php (modified) (18 diffs)
-
wordpress-sparkpost.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sparkpost/trunk/.travis.yml
r1582798 r2373992 1 1 language: php 2 3 services: 4 - mysql 2 5 3 6 notifications: … … 11 14 12 15 php: 13 - 5.614 16 - 7.0 15 17 16 18 env: 17 - WP_VERSION=latest WP_MULTISITE=0 18 - WP_VERSION=4.3 WP_MULTISITE=0 19 - WP_VERSION=4.4 WP_MULTISITE=0 20 - WP_VERSION=4.5 WP_MULTISITE=0 21 - WP_VERSION=4.6 WP_MULTISITE=0 22 - WP_VERSION=4.7 WP_MULTISITE=0 19 - WP_VERSION=5.5 WP_MULTISITE=0 23 20 24 21 before_script: -
sparkpost/trunk/mailer.http.class.php
r2372398 r2373992 124 124 // stored template 125 125 $substitution_data = $this->get_template_substitutes($sender, $replyTo); 126 if (sizeof($attachments) > 0) { // get template preview data and then send it as inline126 if (sizeof($attachments) > 0) { // get template preview data and then send it as inline 127 127 $preview_contents = $this->template->preview($template_id, $substitution_data); 128 128 if ($preview_contents === false) { … … 134 134 ); 135 135 136 if(!empty($content_headers)) { 137 $body['content']['headers'] = $content_headers; 138 } 139 136 140 if (property_exists($preview_contents, 'text')) { 137 141 $body['content']['text'] = $preview_contents->text; … … 146 150 } 147 151 148 } else { // simply subs ititute template tags152 } else { // simply substitute template tags 149 153 $body['content']['template_id'] = $template_id; 150 154 $body['substitution_data'] = $substitution_data; … … 156 160 'subject' => $this->Subject 157 161 ); 162 163 if(!empty($content_headers)) { 164 $body['content']['headers'] = $content_headers; 165 } 158 166 159 167 if ($replyTo) { … … 175 183 } 176 184 177 if(!empty($content_headers)) {178 $body['content']['headers'] = $content_headers;179 }180 181 185 if (sizeof($attachments)) { 182 186 $body['content']['attachments'] = $attachments; -
sparkpost/trunk/readme.txt
r2372398 r2373992 4 4 Requires at least: 5.5 5 5 Tested up to: 5.5 6 Stable tag: 3.2. 26 Stable tag: 3.2.3 7 7 License: GPLv2 or later 8 8 … … 15 15 16 16 **Requirements** 17 - PHP 5.4or later17 - PHP 7.0 or later 18 18 - WordPress 5.5 or later 19 19 … … 52 52 53 53 == Changelog == 54 55 = 3.2.3 = 56 - Fixed broken SparkPost logo on settings page ([157](https://github.com/SparkPost/wordpress-sparkpost/pull/157)) 54 57 55 58 = 3.2.2 = -
sparkpost/trunk/tests/bin/install-wp-tests.sh
r1582798 r2373992 119 119 120 120 # create database 121 mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS" $EXTRA121 mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS" $EXTRA 122 122 } 123 123 -
sparkpost/trunk/tests/specs/test-mailer.http.class.php
r1626130 r2373992 26 26 $stub->shouldReceive('sparkpost_send')->andReturn('woowoo'); 27 27 28 $this->assert True(NSA::invokeMethod($stub, 'mailSend', null, null) =='woowoo');28 $this->assertEquals(NSA::invokeMethod($stub, 'mailSend', null, null), 'woowoo'); 29 29 } 30 30 31 31 function test_mailer_is_a_mailer_instance() { 32 $this->assertTrue( $this->mailer instanceof \PHPMailer );32 $this->assertTrue( $this->mailer instanceof \PHPMailer\PHPMailer\PHPMailer ); 33 33 } 34 34 … … 40 40 ); 41 41 42 $this->assert True(NSA::invokeMethod($this->mailer, 'get_sender') ==$sender);42 $this->assertEquals(NSA::invokeMethod($this->mailer, 'get_sender'), $sender); 43 43 } 44 44 … … 49 49 ); 50 50 51 $this->assert True(NSA::invokeMethod($this->mailer, 'get_sender') ==$sender);51 $this->assertEquals(NSA::invokeMethod($this->mailer, 'get_sender'), $sender); 52 52 } 53 53 … … 58 58 'Authorization' => '' 59 59 ); 60 $this->assert True(NSA::invokeMethod($this->mailer, 'get_request_headers') ==$expected);60 $this->assertEquals(NSA::invokeMethod($this->mailer, 'get_request_headers'), $expected); 61 61 62 62 NSA::setProperty($this->mailer, 'settings', array('password' => 'abcd1234')); … … 66 66 'Authorization' => 'abcd1234' 67 67 ); 68 $this->assert True(NSA::invokeMethod($this->mailer, 'get_request_headers') ==$expected);68 $this->assertEquals(NSA::invokeMethod($this->mailer, 'get_request_headers'), $expected); 69 69 } 70 70 … … 76 76 'Authorization' => 'abcd'.str_repeat('*', 36) 77 77 ); 78 $this->assertTrue(NSA::invokeMethod($this->mailer, 'get_request_headers', true) == $expected); 78 79 $this->assertEquals(NSA::invokeMethod($this->mailer, 'get_request_headers', true), $expected); 79 80 } 80 81 81 82 function test_get_headers() { 82 $raw_headers = "Date: Wed, 26 Oct 2016 23:45:32 +0000 83 To: undisclosed-recipients:; 84 From: Root User <root@localhost> 85 Subject: Hello 86 Reply-To: [email protected] 87 Message-ID: <[email protected]> 88 MIME-Version: 1.0 89 Content-Type: text/plain; charset=iso-8859-1 90 Content-Transfer-Encoding: 8bit"; 83 $stub = Mockery::mock($this->mailer); 84 $raw_headers = join( 85 NSA::getProperty($stub, 'LE'), 86 array( 87 'Date: Wed, 26 Oct 2016 23:45:32 +0000', 88 'To: undisclosed-recipients:;', 89 'From: Root User <root@localhost>', 90 'Subject: Hello', 91 'Reply-To: [email protected]', 92 'Message-ID: <[email protected]>', 93 'MIME-Version: 1.0', 94 'Content-Type: text/plain; charset=iso-8859-1', 95 'Content-Transfer-Encoding: 8bit' 96 ) 97 ); 98 $stub->shouldReceive('createHeader')->andReturn($raw_headers); 99 $formatted_headers = NSA::invokeMethod($stub, 'get_headers'); 91 100 92 101 $expected = array( … … 94 103 'Date' => 'Wed, 26 Oct 2016 23:45:32 +0000' 95 104 ); 105 106 $this->assertEquals($formatted_headers, $expected); 107 } 108 109 110 function test_get_headers_should_include_cc_if_exists() { 96 111 $stub = Mockery::mock($this->mailer); 112 $raw_headers = join( 113 NSA::getProperty($stub, 'LE'), 114 array( 115 'Date: Wed, 26 Oct 2016 23:45:32 +0000', 116 'Reply-To: [email protected]' 117 ) 118 ); 97 119 $stub->shouldReceive('createHeader')->andReturn($raw_headers); 120 $stub->addCc('[email protected]'); 121 $stub->addCc('[email protected]', 'Name'); 122 98 123 $formatted_headers = NSA::invokeMethod($stub, 'get_headers'); 99 100 $this->assertTrue($formatted_headers == $expected);101 }102 103 104 function test_get_headers_should_include_cc_if_exists() {105 $raw_headers = "Date: Wed, 26 Oct 2016 23:45:32 +0000106 Reply-To: [email protected]";107 124 108 125 $expected = array( … … 110 127 'CC' => '[email protected],Name <[email protected]>' 111 128 ); 112 $stub = Mockery::mock($this->mailer); 113 $stub->shouldReceive('createHeader')->andReturn($raw_headers); 114 $stub->addCc('[email protected]'); 115 $stub->addCc('[email protected]', 'Name'); 116 117 $formatted_headers = NSA::invokeMethod($stub, 'get_headers'); 118 119 $this->assertTrue($formatted_headers == $expected); 129 130 $this->assertEquals($formatted_headers, $expected); 120 131 } 121 132 … … 173 184 174 185 $recipients = NSA::invokeMethod($this->mailer, 'get_recipients'); 175 $this->assert True($recipients ==$expected);186 $this->assertEquals($recipients, $expected); 176 187 } 177 188 … … 191 202 // test if isMail sets correct mailer 192 203 $this->mailer->Mailer = 'abc'; 193 $this->assert True($this->mailer->Mailer ==='abc');204 $this->assertEquals($this->mailer->Mailer, 'abc'); 194 205 $this->mailer->isMail(); 195 $this->assert True($this->mailer->Mailer ==='sparkpost');206 $this->assertEquals($this->mailer->Mailer, 'sparkpost'); 196 207 } 197 208 … … 251 262 // alternative is to stub get_headers which isn't working expectedly 252 263 $actual['content']['headers'] = []; 253 $this->assert True($expected_request_body ==$actual);264 $this->assertEquals($expected_request_body, $actual); 254 265 255 266 //INCLUDE REPLYTO … … 259 270 $actual['content']['headers'] = []; //see note above 260 271 $expected_request_body['content']['reply_to'] = 'reply-to <[email protected]>'; 261 $this->assert True($expected_request_body ==$actual);272 $this->assertEquals($expected_request_body, $actual); 262 273 } 263 274 … … 280 291 $body = NSA::invokeMethod($this->mailer, 'get_request_body'); 281 292 remove_filter('wpsp_template_id', $callback); 282 $this->assert True($body['content']['template_id'] =='test-template');293 $this->assertEquals($body['content']['template_id'], 'test-template'); 283 294 } 284 295 … … 334 345 335 346 $actual = NSA::invokeMethod($this->mailer, 'get_request_body'); 336 $this->assert True($expected_request_body ==$actual);347 $this->assertEquals($expected_request_body, $actual); 337 348 338 349 //INCLUDE REPLYTO … … 341 352 $actual = NSA::invokeMethod($this->mailer, 'get_request_body'); 342 353 $expected_request_body['substitution_data']['reply_to'] = 'reply-to <[email protected]>'; 343 $this->assert True($expected_request_body ==$actual);354 $this->assertEquals($expected_request_body, $actual); 344 355 } 345 356 … … 421 432 $actual = NSA::invokeMethod($mailer, 'get_request_body'); 422 433 unset($actual['content']['headers']); //to simplify assertion 423 $this->assert True($expected_request_body ==$actual);434 $this->assertEquals($expected_request_body, $actual); 424 435 } 425 436 … … 520 531 521 532 $body = NSA::invokeMethod($mailer, 'get_request_body'); 522 $this->assertTrue($body['options']['sandbox'] == true);533 $this->assertTrue($body['options']['sandbox']); 523 534 } 524 535 … … 659 670 ->getMock(); 660 671 661 $this->assertTrue($mailer->check_permission_error($response, 'test_perm') === true);672 $this->assertTrue($mailer->check_permission_error($response, 'test_perm')); 662 673 663 674 $response['response']['code'] = 200; 664 $this->assert True($mailer->check_permission_error($response, 'test_perm') === false);675 $this->assertFalse($mailer->check_permission_error($response, 'test_perm')); 665 676 } 666 677 -
sparkpost/trunk/wordpress-sparkpost.php
r2372398 r2373992 6 6 Plugin URI: http://sparkpost.com/ 7 7 Description: Send all your email from Wordpress through SparkPost, the world's most advanced email delivery service. 8 Version: 3.2. 28 Version: 3.2.3 9 9 Author: SparkPost 10 10 Author URI: http://sparkpost.com … … 19 19 define('WPSP_PLUGIN_DIR', plugin_dir_path(__FILE__)); 20 20 define('WPSP_PLUGIN_PATH', WPSP_PLUGIN_DIR . basename(__FILE__)); 21 define('WPSP_PLUGIN_VERSION', '3.2. 2');21 define('WPSP_PLUGIN_VERSION', '3.2.3'); 22 22 23 23 require_once(WPSP_PLUGIN_DIR . 'sparkpost.class.php');
Note: See TracChangeset
for help on using the changeset viewer.