ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PKjn\g  .htaccessnu[Options -IndexesPKjn\,Юcunit/MockClient.phpnu[requestBody = $requestBody; $this->requestHeaders = $requestHeaders; $this->url = $url; return $this; } } PKjn\?abbunit/FilesExistTest.phpnu[assertFileExists("$rootDir/docker/Dockerfile"); //$this->assertFileExists("$rootDir/docker/docker-compose.yml"); $this->assertFileExists("$rootDir/.codeclimate.yml"); $this->assertFileExists("$rootDir/.env.sample"); $this->assertFileExists("$rootDir/.github/ISSUE_TEMPLATE"); $this->assertFileExists("$rootDir/.github/PULL_REQUEST_TEMPLATE"); $this->assertFileExists("$rootDir/.gitignore"); $this->assertFileExists("$rootDir/.travis.yml"); $this->assertFileExists("$rootDir/CHANGELOG.md"); $this->assertFileExists("$rootDir/CODE_OF_CONDUCT.md"); $this->assertFileExists("$rootDir/LICENSE.md"); $this->assertFileExists("$rootDir/README.md"); $this->assertFileExists("$rootDir/TROUBLESHOOTING.md"); $this->assertFileExists("$rootDir/USAGE.md"); $this->assertFileExists("$rootDir/USE_CASES.md"); } } PKjn\g unit/.htaccessnu[Options -IndexesPKjn\:T``unit/ClientTest.phpnu[host = 'https://localhost:4010'; $this->headers = [ 'Content-Type: application/json', 'Authorization: Bearer SG.XXXX' ]; $this->client = new MockClient($this->host, $this->headers, '/v3'); } public function testConstructor() { $this->assertAttributeEquals($this->host, 'host', $this->client); $this->assertAttributeEquals($this->headers, 'headers', $this->client); $this->assertAttributeEquals('/v3', 'version', $this->client); $this->assertAttributeEquals([], 'path', $this->client); $this->assertAttributeEquals([], 'curlOptions', $this->client); $this->assertAttributeEquals(false, 'retryOnLimit', $this->client); $this->assertAttributeEquals(['get', 'post', 'patch', 'put', 'delete'], 'methods', $this->client); } public function test_() { $client = new MockClient($this->host, $this->headers, '/v3'); $client->setCurlOptions(['foo' => 'bar']); $client = $client->_('test'); $this->assertAttributeEquals(['test'], 'path', $client); $this->assertAttributeEquals(['foo' => 'bar'], 'curlOptions', $client); } public function test__call() { $client = $this->client->get(); $this->assertAttributeEquals('https://localhost:4010/v3/', 'url', $client); $queryParams = ['limit' => 100, 'offset' => 0]; $client = $this->client->get(null, $queryParams); $this->assertAttributeEquals('https://localhost:4010/v3/?limit=100&offset=0', 'url', $client); $requestBody = ['name' => 'A New Hope']; $client = $this->client->get($requestBody); $this->assertAttributeEquals($requestBody, 'requestBody', $client); $requestHeaders = ['X-Mock: 200']; $client = $this->client->get(null, null, $requestHeaders); $this->assertAttributeEquals($requestHeaders, 'requestHeaders', $client); $client = $this->client->version('/v4'); $this->assertAttributeEquals('/v4', 'version', $client); $client = $this->client->path_to_endpoint(); $this->assertAttributeEquals(['path_to_endpoint'], 'path', $client); $client = $client->one_more_segment(); $this->assertAttributeEquals(['path_to_endpoint', 'one_more_segment'], 'path', $client); } public function testGetHost() { $client = new Client('https://localhost:4010'); $this->assertSame('https://localhost:4010', $client->getHost()); } public function testGetHeaders() { $client = new Client( 'https://localhost:4010', ['Content-Type: application/json', 'Authorization: Bearer SG.XXXX'] ); $this->assertSame(['Content-Type: application/json', 'Authorization: Bearer SG.XXXX'], $client->getHeaders()); $client2 = new Client('https://localhost:4010'); $this->assertSame([], $client2->getHeaders()); } public function testGetVersion() { $client = new Client('https://localhost:4010', [], '/v3'); $this->assertSame('/v3', $client->getVersion()); $client = new Client('https://localhost:4010'); $this->assertNull($client->getVersion()); } public function testGetPath() { $client = new Client('https://localhost:4010', [], null, ['/foo/bar']); $this->assertSame(['/foo/bar'], $client->getPath()); $client = new Client('https://localhost:4010'); $this->assertSame([], $client->getPath()); } public function testGetCurlOptions() { $client = new Client('https://localhost:4010'); $client->setCurlOptions([CURLOPT_PROXY => '127.0.0.1:8080']); $this->assertSame([CURLOPT_PROXY => '127.0.0.1:8080'], $client->getCurlOptions()); $client = new Client('https://localhost:4010'); $this->assertSame([], $client->getCurlOptions()); } public function testCurlMulti() { $client = new Client('https://localhost:4010'); $client->setIsConcurrentRequest(true); $client->get(['name' => 'A New Hope']); $client->get(null, null, ['X-Mock: 200']); $client->get(null, ['limit' => 100, 'offset' => 0]); // returns 3 response object $this->assertCount(3, $client->send()); } public function testCreateCurlOptionsWithMethodOnly() { $client = new Client('https://localhost:4010'); $result = $this->callMethod($client, 'createCurlOptions', ['get']); $this->assertEquals([ CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_SSL_VERIFYPEER => true, CURLOPT_FAILONERROR => false, CURLOPT_HTTPHEADER => [] ], $result); } public function testCreateCurlOptionsWithBody() { $client = new Client('https://localhost:4010', ['User-Agent: Custom-Client 1.0']); $client->setCurlOptions([ CURLOPT_ENCODING => 'utf-8' ]); $body = ['foo' => 'bar']; $result = $this->callMethod($client, 'createCurlOptions', ['post', $body]); $this->assertEquals([ CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => true, CURLOPT_FAILONERROR => false, CURLOPT_ENCODING => 'utf-8', CURLOPT_POSTFIELDS => json_encode($body), CURLOPT_HTTPHEADER => [ 'User-Agent: Custom-Client 1.0', 'Content-Type: application/json' ] ], $result); } public function testCreateCurlOptionsWithBodyAndHeaders() { $client = new Client('https://localhost:4010', ['User-Agent: Custom-Client 1.0']); $client->setCurlOptions([ CURLOPT_ENCODING => 'utf-8' ]); $body = ['foo' => 'bar']; $headers = ['Accept-Encoding: gzip']; $result = $this->callMethod($client, 'createCurlOptions', ['post', $body, $headers]); $this->assertEquals([ CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => true, CURLOPT_FAILONERROR => false, CURLOPT_ENCODING => 'utf-8', CURLOPT_POSTFIELDS => json_encode($body), CURLOPT_HTTPHEADER => [ 'User-Agent: Custom-Client 1.0', 'Accept-Encoding: gzip', 'Content-Type: application/json' ] ], $result); } public function testThrowExceptionOnInvalidCall() { $this->expectException(InvalidRequest::class); $client = new Client('invalid://url', ['User-Agent: Custom-Client 1.0']); $client->get(); } public function testMakeRequestWithUntrustedRootCert() { $this->expectException(InvalidRequest::class); $this->expectExceptionMessageRegExp('/certificate/i'); $client = new Client('https://untrusted-root.badssl.com/'); $client->makeRequest('GET', 'https://untrusted-root.badssl.com/'); } /** * @param object $obj * @param string $name * @param array $args * @return mixed */ private function callMethod($obj, $name, $args = []) { try { $class = new \ReflectionClass($obj); } catch (\ReflectionException $e) { return null; } $method = $class->getMethod($name); $method->setAccessible(true); return $method->invokeArgs($obj, $args); } } PKjn\7|unit/ResponseTest.phpnu[assertAttributeEquals(200, 'statusCode', $response); $this->assertAttributeEquals('', 'body', $response); $this->assertAttributeEquals([], 'headers', $response); $response = new Response(201, 'test', ['Content-Encoding: gzip']); $this->assertAttributeEquals(201, 'statusCode', $response); $this->assertAttributeEquals('test', 'body', $response); $this->assertAttributeEquals(['Content-Encoding: gzip'], 'headers', $response); } public function testStatusCode() { $response = new Response(404); $this->assertEquals(404, $response->statusCode()); } public function testBody() { $response = new Response(null, 'foo'); $this->assertEquals('foo', $response->body()); } public function testHeaders() { $response = new Response(null, null, ['Content-Type: text/html']); $this->assertEquals(['Content-Type: text/html'], $response->headers()); } public function testAssociativeHeaders() { $response = new Response(null, null, ['Content-Type: text/html', 'HTTP/1.1 200 OK']); $this->assertEquals(['Content-Type' => 'text/html', 'Status' => 'HTTP/1.1 200 OK'], $response->headers(true)); } } PKjn\12uunit/LicenceYearTest.phpnu["; $this->assertEquals($expected, $copyright); } } PKjn\_phpunit.xml.distnu[ . ../lib PK\UB4: : mailpit_message_user.phpnu[. namespace core\test; /** * Message user interface for Mailpit. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Andrew Lyons */ class mailpit_message_user implements message_user { /** * Create a new message user object from a sender. * * @param \stdClass $user The user object. * @return self */ public static function from_sender( \stdClass $user, ): self { return new self( name: $user->Name, address: $user->Address, ); } /** * Create a new message user object from a recipient. * * @param \stdClass $user The user object. * @return self */ public static function from_recipient( \stdClass $user, ): self { return new self( name: $user->Name, address: $user->Address, ); } /** * Constructor. * * @param string $name The name of the user. * @param string $address The email address of the user. */ protected function __construct( /** @var string The name of the user. */ protected string $name, /** @var string The email address of the user. */ protected string $address ) { } /** * Get the display name of the user. * * @return string */ public function get_name(): string { return $this->name; } /** * Get the email address of the user. * * @return string */ public function get_address(): string { return $this->address; } } PK\q-U  email_catcher.phpnu[. namespace core\test; /** * Generic email catcher interface. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Simey Lameze */ interface email_catcher { /** * Get a list of messages from the mailpit server. * * @param bool $showdetails Optional. Whether to include detailed information in the messages. Default is false. * @return iterable */ public function get_messages(bool $showdetails = false): iterable; /** * Delete all messages from the mailpit server. */ public function delete_all(); /** * Search for a message in the mailpit server. * * @param string $query The search query. * @return iterable */ public function search(string $query): iterable; } PK\FHcc message.phpnu[. namespace core\test; /** * Generic message interface. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Simey Lameze */ interface message { /** * Get the message subject. * * @return string */ public function get_subject(): string; /** * Get the text representation of the body, if one was provided. * * @return null|string */ public function get_body_text(): ?string; /** * Get the HTML representation of the body, if one was provided. * * @return null|string */ public function get_body_html(): ?string; /** * Get the message sender. * * @return message_user */ public function get_sender(): message_user; /** * Get the message recipients. * * @return iterable */ public function get_recipients(): iterable; /** * Whether the message has the specified recipient. * * @param string $email The email address. * @return bool */ public function has_recipient(string $email): bool; /** * Get the message cc recipients. * * @return iterable */ public function get_cc(): iterable; /** * Get the message cc recipients. * * @return iterable */ public function get_bcc(): iterable; } PK\X0mailpit_message.phpnu[. namespace core\test; use stdClass; /** * Mailpit message handling implementation. * * @package core * @category test * @copyright Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mailpit_message implements message { /** @var bool Whether the message has been loaded. */ protected bool $messageloaded = false; /** * Constructor. * * @param email_catcher $client The email catcher client. * @param string $id The message ID. * @param stdClass $sender The sender. * @param string $subject The subject. * @param array $recipients The recipients. * @param array $cc The cc recipients. * @param array $bcc The bcc recipients. * @param int $attachmentcount The number of attachments. * @param string|null $text The text body. * @param string|null $html The HTML body. * @param array $attachments The attachments. * @param array $inline The inline attachments. */ protected function __construct( /** @var email_catcher $client The email catcher client used for message operations.*/ private readonly email_catcher $client, /** @var string $id The unique identifier for the message. */ private readonly string $id, /** @var stdClass $sender The sender of the message, represented as an object with email details. */ private readonly stdClass $sender, /** @var string $subject The subject line of the message. */ private readonly string $subject, /** @var array $recipients List of primary recipients for the message. */ private readonly array $recipients, /** @var array $cc List of carbon copy recipients (optional, defaults to an empty array). */ private readonly array $cc = [], /** @var array $bcc List of blind carbon copy recipients (optional, defaults to an empty array). */ private readonly array $bcc = [], /** @var int $attachmentcount The number of attachments in the message (default is 0). */ private readonly int $attachmentcount = 0, /** @var ?string $text The plain text body of the message (nullable, might be loaded later). */ private ?string $text = null, /** @var ?string $html The HTML body of the message (nullable, might be loaded later). */ private ?string $html = null, /** @var array $attachments An array of attachment details (defaults to empty array). */ private array $attachments = [], /** @var array $inline An array of inline elements like images or styles (defaults to empty array). */ private array $inline = [], ) { } /** * Load the message content. */ protected function load_message_content(): void { if (!$this->messageloaded) { $message = $this->client->get_message_data($this->id); $this->text = $message->Text; $this->html = $message->HTML; $this->attachments = $message->Attachments; $this->inline = $message->Inline; $this->messageloaded = true; } } /** * Create a message from an api response. * * @param email_catcher $client The email catcher client. * @param stdClass $message The api response. * @param bool $showdetails Optional. Whether to include detailed information in the messages. Default is false. * @return mailpit_message The created mailpit message instance. */ public static function create_from_api_response( email_catcher $client, stdClass $message, bool $showdetails = false, ): self { $message = new self( client: $client, id: $message->ID, sender: $message->From, subject: $message->Subject, recipients: $message->To, cc: $message->Cc, attachmentcount: $message->Attachments, ); if ($showdetails) { $message->load_message_content(); } return $message; } /** * Get the text representation of the body, if one was provided. * * @return null|string The text body. */ public function get_body_text(): ?string { return $this->text; } /** * Get the HTML representation of the body, if one was provided. * * @return null|string The HTML body. */ public function get_body_html(): ?string { return $this->html; } /** * Get the message ID. * * @return string The ID. */ public function get_id(): string { return $this->id; } /** * Get the message recipients. * * @return iterable The recipients. */ public function get_recipients(): iterable { foreach ($this->recipients as $user) { yield mailpit_message_user::from_recipient($user); } } /** * Get the first recipient of the message. * * @return string The email address of the first recipient. */ public function get_first_recipient(): string { $recipients = $this->get_recipients(); foreach ($recipients as $recipient) { return $recipient->get_address(); } return ''; } /** * Whether the message has the specified recipient. * * @param string $email The email address. * @return bool Whether the message has the recipient. */ public function has_recipient(string $email): bool { foreach ($this->get_recipients() as $recipient) { if ($recipient->get_address() === $email) { return true; } } return false; } /** * Get the message cc recipients. * * @return iterable The cc recipients. */ public function get_cc(): iterable { foreach ($this->cc as $user) { yield mailpit_message_user::from_recipient($user); } } /** * Get the message bcc recipients. * * @return iterable The bcc recipients. */ public function get_bcc(): iterable { foreach ($this->bcc as $user) { yield mailpit_message_user::from_recipient($user); } } /** * Get the message subject. * * @return string The subject. */ public function get_subject(): string { return $this->subject; } /** * Get the message sender. * * @return message_user The sender. */ public function get_sender(): message_user { return mailpit_message_user::from_sender($this->sender); } } PK\message_user.phpnu[. namespace core\test; /** * Generic message user interface. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Andrew Lyons */ interface message_user { /** * Get the display name of the user. * * @return string */ public function get_name(): string; /** * Get the email address of the user. * * @return string */ public function get_address(): string; } PK\6mailpit_email_catcher.phpnu[. /** * Mailpit mail handling implementation. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Simey Lameze */ namespace core\test; use core\http_client; use stdClass; /** * Mailpit email handling class. * * @package core * @category test * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mailpit_email_catcher implements email_catcher { /** @var http_client The http client object. */ protected http_client $httpclient; /** * Constructor. * * @param string $baseuri The base uri for the mailpit server. */ public function __construct(string $baseuri) { $this->httpclient = new http_client(['base_uri' => $baseuri]); } /** * Reset the mailpit server after a test. */ public function reset_after_test(): void { $this->httpclient->delete_all(); } /** * Delete all messages from the mailpit server. */ public function delete_all() { $this->httpclient->delete('api/v1/messages'); } /** * Get a list of messages from the mailpit server. * * @param bool $showdetails Optional. Whether to include detailed information in the messages. Default is false. * @return iterable */ public function get_messages(bool $showdetails = false): iterable { $uri = 'api/v1/messages'; $options = [ 'query' => [ 'start' => 0, ], ]; do { $response = $this->httpclient->get( uri: $uri, options: $options, ); $data = json_decode($response->getBody()); foreach ($data->messages as $messagedata) { yield mailpit_message::create_from_api_response($this, $messagedata, $showdetails); } $options['query']['start'] = $data->start + $data->count; } while ($data->total > ($options['query']['start'])); } /** * Get the message summary for a specific message. * * @param string $id The message id. * @return stdClass */ public function get_message_data(string $id): stdClass { $response = $this->httpclient->get("api/v1/message/{$id}"); return json_decode($response->getBody()); } /** * Search for a message in the mailpit server. * * @param string $query The search query. * @return mixed */ public function search(string $query): iterable { $uri = "api/v1/search?query={$query}"; $response = $this->httpclient->get($uri); $data = json_decode($response->getBody()); foreach ($data->messages as $messagedata) { yield mailpit_message::create_from_api_response($this, $messagedata); } } } PK\(SStest_helpers.jsnu[var zeropad = function (num) { return ((num < 10) ? '0' : '') + num; }; var iso8601 = function (date) { return date.getUTCFullYear() + "-" + zeropad(date.getUTCMonth()+1) + "-" + zeropad(date.getUTCDate()) + "T" + zeropad(date.getUTCHours()) + ":" + zeropad(date.getUTCMinutes()) + ":" + zeropad(date.getUTCSeconds()) + "Z"; }; function prepareDynamicDates() { $('time.loaded').attr("datetime", iso8601(new Date())); $('time.modified').attr("datetime", iso8601(new Date(document.lastModified))); } function loadNumbers() { jQuery.timeago.settings.strings.numbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; } function unloadNumbers() { jQuery.timeago.settings.strings.numbers = []; } function loadCutoffSetting() { jQuery.timeago.settings.cutoff = 7*24*60*60*1000; } function unloadCutoffSetting() { jQuery.timeago.settings.cutoff = 0; } function setupDisposal() { jQuery.timeago.settings.refreshMillis = 25; $('abbr.disposal').attr("title", iso8601(new Date())).timeago(); } function loadPigLatin() { jQuery.timeago.settings.strings = { suffixAgo: "ago-hay", suffixFromNow: "omNow-fray", seconds: "ess-lay an-thay a-hay inute-may", minute: "about-hay a-hay inute-may", minutes: "%d inutes-may", hour: "about-hay an-hay hour-hay", hours: "about-hay %d hours-hay", day: "a-hay ay-day", days: "%d ays-day", month: "about-hay a-hay onth-may", months: "%d onths-may", year: "about-hay a-hay ear-yay", years: "%d years-yay" }; } function loadPolish() { (function () { // Polish function numpf(n, s, t) { // s - 2-4, 22-24, 32-34 ... // t - 5-21, 25-31, ... var n10 = n % 10; if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { return s; } else { return t; } } jQuery.timeago.settings.strings = { prefixAgo: null, prefixFromNow: "za", suffixAgo: "temu", suffixFromNow: null, seconds: "mniej niż minutę", minute: "minutę", minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); }, hour: "godzinę", hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); }, day: "dzień", days: "%d dni", month: "miesiąc", months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); }, year: "rok", years: function(value) { return numpf(value, "%d lata", "%d lat"); } }; })(); } function loadRussian() { (function() { function numpf(n, f, s, t) { // f - 1, 21, 31, ... // s - 2-4, 22-24, 32-34 ... // t - 5-20, 25-30, ... var n10 = n % 10; if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) { return f; } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { return s; } else { return t; } } jQuery.timeago.settings.strings = { prefixAgo: null, prefixFromNow: "через", suffixAgo: "назад", suffixFromNow: null, seconds: "меньше минуты", minute: "минуту", minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); }, hour: "час", hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); }, day: "день", days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); }, month: "месяц", months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); }, year: "год", years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); } }; })(); } function loadBelarusian() { (function() { function numpf(n, f, s, t) { // f - 1, 21, 31, ... // s - 2-4, 22-24, 32-34 ... // t - 5-20, 25-30, ... var n10 = n % 10; if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) { return f; } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { return s; } else { return t; } } jQuery.timeago.settings.strings = { prefixAgo: null, prefixFromNow: "праз", suffixAgo: "таму", suffixFromNow: null, seconds: "менш хвіліны", minute: "хвіліну", minutes: function(value) { return numpf(value, "%d хвіліна", "%d хвіліны", "%d хвілін"); }, hour: "гадзіну", hours: function(value) { return numpf(value, "%d гадзіна", "%d гадзіны", "%d гадзін"); }, day: "дзень", days: function(value) { return numpf(value, "%d дзень", "%d дні", "%d дзён"); }, month: "месяц", months: function(value) { return numpf(value, "%d месяц", "%d месяцы", "%d месяцаў"); }, year: "год", years: function(value) { return numpf(value, "%d год", "%d гады", "%d гадоў"); } }; })(); } function resetRefreshMillis() { jQuery.timeago.settings.refreshMillis = 60000; } function loadMillis() { var millisSubstitution = function(number, millis) { return millis + " milliseconds"; }; jQuery.timeago.settings.strings = { suffixAgo: "ago", suffixFromNow: "from now", seconds: millisSubstitution, minute: millisSubstitution, minutes: millisSubstitution, hour: millisSubstitution, hours: millisSubstitution, day: millisSubstitution, days: millisSubstitution, month: millisSubstitution, months: millisSubstitution, year: millisSubstitution, years: millisSubstitution }; } function loadNoSpaces() { jQuery.extend(jQuery.timeago.settings.strings, { minutes: "%dminutes", wordSeparator: "" }); } function loadNullSpaces() { jQuery.extend(jQuery.timeago.settings.strings, { minutes: "%dminutes", wordSeparator: null }); } function loadYoungOldYears() { jQuery.extend(jQuery.timeago.settings.strings, { years: function(value) { return (value < 21) ? "%d young years" : "%d old years"; } }); } function loadDoNotAllowFuture() { var mockDateToUse = "2010-01-01"; $.timeago.settings.allowFuture = false; enableMockedDate(mockDateToUse); } function unloadDoNotAllowFuture() { $.timeago.settings.allowFuture = true; disableMockedDate(); } function loadDoNotAllowPast() { var mockDateToUse = "2010-01-01"; $.timeago.settings.allowFuture = true; $.timeago.settings.allowPast = false; $.timeago.settings.strings.inPast = "in the past"; enableMockedDate(mockDateToUse); } function unloadDoNotAllowPast() { $.timeago.settings.allowFuture = true; $.timeago.settings.allowPast = true; disableMockedDate(); } function enableMockedDate(dateToReturn) { var mockDate = dateToReturn; window.NativeDate = Date; window.Date = function () { if(arguments.length === 0) { return new window.NativeDate(mockDate); } else if(arguments.length === 1) { return new window.NativeDate(arguments[0]); } else if(arguments.length === 7) { return new window.NativeDate(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]); } else { throw "Mocking Date with this number of parameters is not implemented."; } }; } function disableMockedDate() { window.Date = window.NativeDate; delete window.NativeDate; } PK\ 3ff index.htmlnu[ jQuery-Timeago Test Suite

Short term

You opened this page .

This page was last modified .

Long term

Jett was born (you shouldn't see this) [from Z].

Jett was born (you shouldn't see this) [from -0500].

Logan was born (you shouldn't see this) [from Z].

Logan was born (you shouldn't see this) [from -0400].

Ryan was born (you shouldn't see this) [from Z].

Ryan was born (you shouldn't see this) [from -0500].

Other formats

Date only (abbr element): (you shouldn't see this).

Date only (time element): .

Date only (friendly tooltip): February 26th.

Date only (default tooltip): .

Timestsamp (with millis): (you shouldn't see this).

Cutoff

Date that is before a past cutoff: (this should be displayed)

Date that is after a past cutoff:

Date that is past a future cutoff: (this should be displayed)

Date that is before a future cutoff:

Errors

Bad (letters): (this should be displayed).

Bad (blank): (this should be displayed).

Bad (missing): (this should be displayed).

Parsing

Ryan was born…

  • [from Z]
  • [from -00:00]
  • [from -05:00]
  • [from -0500]
  • [from +09:00]
  • [from +0900]
  • [from blank TZ]
  • [from Z with milliseconds]
  • [from Z with microseconds]
  • [from Z with tenths of a second]
  • [from Z with hundreths of a second]
  • [from +09]

Wording

  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [45 min]
  • [89 min]
  • [90 min]
  • [120 min]
  • [1380 min]
  • [25 hours]
  • [41 hours]
  • [42 hours]
  • [48 hours]
  • [696 hours]
  • [30 days]
  • [190 days]
  • [366 days]
  • [725 days]
  • [1095 days]

Settings

  • [2 min]
  • [9 min]
  • [10 min]
  • [5840 days]
  • [23360 days]
  • [120 sec]
  • [120 sec]
  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [45 min]
  • [89 min]
  • [90 min]
  • [120 min]
  • [1380 min]
  • [25 hours]
  • [48 hours]
  • [696 hours]
  • [30 days]
  • [190 days]
  • [366 days]
  • [1095 days]
  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [45 min]
  • [89 min]
  • [90 min]
  • [120 min]
  • [1380 min]
  • [25 hours]
  • [48 hours]
  • [696 hours]
  • [30 days]
  • [190 days]
  • [366 days]
  • [1095 days]
  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [45 min]
  • [89 min]
  • [90 min]
  • [120 min]
  • [1380 min]
  • [25 hours]
  • [48 hours]
  • [696 hours]
  • [30 days]
  • [190 days]
  • [366 days]
  • [1095 days]
  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [-120 min]
  • [-60 sec]
  • [-30 sec]
  • [-1 sec]
  • [0 sec]
  • [30 sec]
  • [45 sec]
  • [90 sec]
  • [120 sec]
  • [45 min]
  • [89 min]
  • [90 min]
  • [120 min]
  • [1380 min]
  • [25 hours]
  • [48 hours]
  • [696 hours]
  • [30 days]
  • [190 days]
  • [366 days]
  • [1095 days]

Do Not Allow Future

  • (you shouldn't see this)

Do Not Allow Past

  • (you shouldn't see this)

Disposal

PKwf\FsQmmprism.shnu[#!/bin/bash set -xe install () { set -eu UNAME=$(uname) ARCH=$(uname -m) if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases" exit 1 fi if [ "$UNAME" = "Darwin" ] ; then OSX_ARCH=$(uname -m) if [ "${OSX_ARCH}" = "x86_64" ] ; then PLATFORM="darwin_amd64" fi elif [ "$UNAME" = "Linux" ] ; then LINUX_ARCH=$(uname -m) if [ "${LINUX_ARCH}" = "i686" ] ; then PLATFORM="linux_386" elif [ "${LINUX_ARCH}" = "x86_64" ] ; then PLATFORM="linux_amd64" fi fi #LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2) LATEST="v0.1.5" URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM" mkdir -p $(pwd)/prism/bin DEST=$(pwd)/prism/bin/prism if [ -z $LATEST ] ; then echo "Error requesting. Download binary from ${URL}" exit 1 else curl -L $URL -o $DEST chmod +x $DEST fi } install PKwf\g data/.htaccessnu[Options -IndexesPKwf\ 0:6 data/test.txtnu[hello PKwf\g unit/ApiKeys/.htaccessnu[Options -IndexesPKwf\unit/ApiKeys/ApiKeysTest.phpnu[client->api_keys()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testApiKeysGetMethod() { $query_params = json_decode('{"limit": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->api_keys()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testApiKeysIdPutMethod() { $request_body = json_decode('{ "name": "A New Hope", "scopes": [ "user.profile.read", "user.profile.update" ] }'); $api_key_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->api_keys()->_($api_key_id)->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testApiKeysIdPatchMethod() { $request_body = json_decode('{ "name": "A New Hope" }'); $api_key_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->api_keys()->_($api_key_id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testApiKeysIdGetMethod() { $api_key_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->api_keys()->_($api_key_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testApiKeysIdDeleteMethod() { $api_key_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->api_keys()->_($api_key_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\g unit/Alerts/.htaccessnu[Options -IndexesPKwf\E"Sunit/Alerts/AlertsTest.phpnu[client->alerts()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAlertsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->alerts()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAlertsIdPatchMethod() { $request_body = json_decode('{ "email_to": "example@example.com" }'); $alert_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->alerts()->_($alert_id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAlertsIdGetMethod() { $alert_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->alerts()->_($alert_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAlertsIdDeleteMethod() { $alert_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->alerts()->_($alert_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\t4unit/Asm/AsmGroupsTest.phpnu[client->asm()->groups()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAsmGroupsGetMethod() { $query_params = json_decode('{"id": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->groups()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmGroupsIdPatchMethod() { $request_body = json_decode('{ "description": "Suggestions for items our users might like.", "id": 103, "name": "Item Suggestions" }'); $group_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->asm()->groups()->_($group_id)->patch($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAsmGroupsIdGetMethod() { $group_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->groups()->_($group_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmGroupsIdDeleteMethod() { $group_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->asm()->groups()->_($group_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testAsmGroupsIdSuppressionPostMethod() { $request_body = json_decode('{ "recipient_emails": [ "test1@example.com", "test2@example.com" ] }'); $group_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAsmGroupsIdSuppressionGetMethod() { $group_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmGroupsIdSuppressionSearchPostMethod() { $request_body = json_decode('{ "recipient_emails": [ "exists1@example.com", "exists2@example.com", "doesnotexists@example.com" ] }'); $group_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->search() ->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmGroupsIdSuppressionEmailDeleteMethod() { $group_id = "test_url_param"; $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->_($email) ->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\g unit/Asm/.htaccessnu[Options -IndexesPKwf\0unit/Asm/AsmSuppressionTest.phpnu[client->asm()->suppressions()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmSuppressionGlobalPostMethod() { $request_body = json_decode('{ "recipient_emails": [ "test1@example.com", "test2@example.com" ] }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->asm()->suppressions()->global()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAsmSuppressionGlobalEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->suppressions()->global()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAsmSuppressionGlobalEmailDeleteMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->asm()->suppressions()->global()->_($email)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testAsmSuppressionEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->asm()->suppressions()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Scopes/.htaccessnu[Options -IndexesPKwf\{nnunit/Scopes/ScopesTest.phpnu[client->scopes()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Campaigns/.htaccessnu[Options -IndexesPKwf\ unit/Campaigns/CampaignsTest.phpnu[

Check out our spring line!

", "ip_pool": "marketing", "list_ids": [ 110, 124 ], "plain_content": "Check out our spring line!", "segment_ids": [ 110 ], "sender_id": 124451, "subject": "New Products for Spring!", "suppression_group_id": 42, "title": "March Newsletter" }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->campaigns()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testCampaignsGetMethod() { $query_params = json_decode('{"limit": 1, "offset": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->campaigns()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCampaignsIdPatchMethod() { $request_body = json_decode('{ "categories": [ "summer line" ], "html_content": "

Check out our summer line!

", "plain_content": "Check out our summer line!", "subject": "New Products for Summer!", "title": "May Newsletter" }'); $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->campaigns()->_($campaign_id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCampaignsIdGetMethod() { $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->campaigns()->_($campaign_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCampaignsIdDeleteMethod() { $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->campaigns()->_($campaign_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testCampaignsIdSchedulesPatchMethod() { $request_body = json_decode('{ "send_at": 1489451436 }'); $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCampaignsIdSchedulesPostMethod() { $request_body = json_decode('{ "send_at": 1489771528 }'); $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testCampaignsIdSchedulesGetMethod() { $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCampaignsIdSchedulesDeleteMethod() { $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testCampaignsIdSchedulesNowPostMethod() { $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->now()->post(null, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testCampaignsIdSchedulesTestPostMethod() { $request_body = json_decode('{ "to": "your.email@example.com" }'); $campaign_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->test() ->post($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\w1LPPunit/Stats/BrowserStatsTest.phpnu[client->browsers()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\unit/Stats/StatsTest.phpnu[client->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Stats/.htaccessnu[Options -IndexesPKwf\ݏ;unit/Stats/DevicesStatsTest.phpnu[client->devices()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\Y&!!unit/Stats/GeoStatsTest.phpnu[client->geo()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\@unit/Stats/ClientsStatsTest.phpnu[client->clients()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testClientsClientTypeStatsGetMethod() { $query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}'); $client_type = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->clients()->_($client_type)->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Contacts/.htaccessnu[Options -IndexesPKwf\P<<unit/Contacts/ContactDbTest.phpnu[client->contactdb() ->custom_fields() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbCustomFieldsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->custom_fields() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbCustomFieldsIdGetMethod() { $custom_field_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->custom_fields() ->_($custom_field_id) ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbCustomFieldsIdDeleteMethod() { $custom_field_id = "test_url_param"; $request_headers = ["X-Mock: 202"]; $response = self::$sg->client->contactdb() ->custom_fields() ->_($custom_field_id) ->delete(null, null, $request_headers); $this->assertEquals(202, $response->statusCode()); } public function testContactDbListsPostMethod() { $request_body = json_decode('{ "name": "your list name" }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->contactdb() ->lists() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbListsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->lists() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbListsDeleteMethod() { $request_body = json_decode('[ 1, 2, 3, 4 ]'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->contactdb() ->lists() ->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testContactDbListsIdPatchMethod() { $request_body = json_decode('{ "name": "newlistname" }'); $query_params = json_decode('{"list_id": 1}'); $list_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->patch($request_body, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbListsIdGetMethod() { $query_params = json_decode('{"list_id": 1}'); $list_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbListsIdDeleteMethod() { $query_params = json_decode('{"delete_contacts": "true"}'); $list_id = "test_url_param"; $request_headers = ["X-Mock: 202"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->delete(null, $query_params, $request_headers); $this->assertEquals(202, $response->statusCode()); } public function testContactDbListsIdRecipientsPostMethod() { $request_body = json_decode('[ "recipient_id1", "recipient_id2" ]'); $list_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->recipients() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbListsIdRecipientsGetMethod() { $query_params = json_decode('{"page": 1, "page_size": 1, "list_id": 1}'); $list_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->recipients() ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbListsIdRecipientsIdPostMethod() { $list_id = "test_url_param"; $recipient_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->recipients() ->_($recipient_id) ->post(null, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbListsIdRecipientsIdDeleteMethod() { $query_params = json_decode('{"recipient_id": 1, "list_id": 1}'); $list_id = "test_url_param"; $recipient_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->contactdb() ->lists() ->_($list_id) ->recipients() ->_($recipient_id) ->delete(null, $query_params, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testContactDbRecipientsPatchMethod() { $request_body = json_decode('[ { "email": "jones@example.com", "first_name": "Guy", "last_name": "Jones" } ]'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->contactdb() ->recipients() ->patch($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbRecipientsPostMethod() { $request_body = json_decode('[ { "age": 25, "email": "example@example.com", "first_name": "", "last_name": "User" }, { "age": 25, "email": "example2@example.com", "first_name": "Example", "last_name": "User" } ]'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->contactdb() ->recipients() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testContactDbRecipientsGetMethod() { $query_params = json_decode('{"page": 1, "page_size": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsDeleteMethod() { $request_body = json_decode('[ "recipient_id1", "recipient_id2" ]'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->delete($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsBillableCountGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->billable_count() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsCountMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->count() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsSearchGetMethod() { $query_params = json_decode('{"{field_name}": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->search() ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsIdGetMethod() { $recipient_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->_($recipient_id) ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbRecipientsIdDeleteMethod() { $recipient_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->contactdb() ->recipients() ->_($recipient_id) ->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testContactDbRecipientsIdListsGetMethod() { $recipient_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->recipients() ->_($recipient_id) ->lists() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbReservedFieldsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->reserved_fields() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbSegmentsPostMethod() { $request_body = json_decode('{ "conditions": [ { "and_or": "", "field": "last_name", "operator": "eq", "value": "Miller" }, { "and_or": "and", "field": "last_clicked", "operator": "gt", "value": "01/02/2015" }, { "and_or": "or", "field": "clicks.campaign_identifier", "operator": "eq", "value": "513" } ], "list_id": 4, "name": "Last Name Miller" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->segments() ->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbSegmentsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->segments() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbSegmentsIdPatchMethod() { $request_body = json_decode('{ "conditions": [ { "and_or": "", "field": "last_name", "operator": "eq", "value": "Miller" } ], "list_id": 5, "name": "The Millers" }'); $query_params = json_decode('{"segment_id": "test_string"}'); $segment_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->segments() ->_($segment_id) ->patch($request_body, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbSegmentsIdGetMethod() { $query_params = json_decode('{"segment_id": 1}'); $segment_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->segments() ->_($segment_id) ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testContactDbSegmentsIdDeleteMethod() { $query_params = json_decode('{"delete_contacts": "true"}'); $segment_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->contactdb() ->segments() ->_($segment_id) ->delete(null, $query_params, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testContactDbSegmentsIdRecipientsGetMethod() { $query_params = json_decode('{"page": 1, "page_size": 1}'); $segment_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->contactdb() ->segments() ->_($segment_id) ->recipients() ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\]B B unit/BaseTestClass.phpnu[ 'http://localhost:4010']; self::$sg = new SendGrid(self::$apiKey, $host); if (!is_int(self::$pid)) { if (file_exists('/usr/local/bin/prism') == false) { if (strtoupper(substr(php_uname('s'), 0, 3)) != 'WIN') { try { $proc_ls = proc_open( "curl https://raw.githubusercontent.com/stoplightio/prism/master/install.sh", [ ["pipe", "r"], //stdin ["pipe", "w"], //stdout ["pipe", "w"] //stderr ], $pipes ); $output_ls = stream_get_contents($pipes[1]); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); $return_value_ls = proc_close($proc_ls); $proc_grep = proc_open( "sh", [ ["pipe", "r"], //stdin ["pipe", "w"], //stdout ["pipe", "w"] //stderr ], $pipes ); fwrite($pipes[0], $output_ls); fclose($pipes[0]); $output_grep = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); proc_close($proc_grep); } catch (\Exception $e) { print("Error downloading the prism binary, you can try downloading directly here (https://github.com/stoplightio/prism/releases) and place in your /usr/local/bin directory: " . $e->getMessage() . "\n"); exit(); } } else { print("Please download the Windows binary (https://github.com/stoplightio/prism/releases) and place it in your /usr/local/bin directory"); exit(); } } print("Activating Prism (~20 seconds)\n"); $command = 'nohup prism run -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json > /dev/null 2>&1 & echo $!'; exec($command, $op); self::$pid = (int)$op[0]; sleep(15); print("\nPrism Started\n\n"); } } } PKwf\AZZunit/GenericTest.phpnu[assertEquals(SendGrid::VERSION, '6.2.0'); $this->assertEquals(json_decode(file_get_contents(__DIR__ . '/../../composer.json'))->version, SendGrid::VERSION); } public function testCanConnectToSendGridApi() { $sg = new SendGrid(self::$apiKey); $headers = [ 'Authorization: Bearer ' . self::$apiKey, 'User-Agent: sendgrid/' . $sg->version . ';php', 'Accept: application/json' ]; $this->assertEquals($sg->client->getHost(), 'https://api.sendgrid.com', '/v3'); $this->assertEquals($sg->client->getHeaders(), $headers); $this->assertEquals($sg->client->getVersion(), '/v3'); $sg2 = new SendGrid(self::$apiKey, ['host' => 'https://api.test.com']); $this->assertEquals($sg2->client->getHost(), 'https://api.test.com'); $sg3 = new SendGrid(self::$apiKey, ['curl' => ['foo' => 'bar']]); $this->assertEquals(['foo' => 'bar'], $sg3->client->getCurlOptions()); $sg4 = new SendGrid(self::$apiKey, ['curl' => [CURLOPT_PROXY => '127.0.0.1:8000']]); $this->assertEquals($sg4->client->getCurlOptions(), [10004 => '127.0.0.1:8000']); } public function testHelloWorld() { $from = new SendGrid\Email("Example User", "test@example.com"); $subject = "Sending with SendGrid is Fun"; $to = new SendGrid\Email("Example User", "test@example.com"); $content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP"); $mail = new SendGrid\Mail($from, $subject, $to, $content); $json = json_encode($mail->jsonSerialize()); $this->assertEquals( $json, '{"from":{"name":"Example User","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"}]}],"subject":"Sending with SendGrid is Fun","content":[{"type":"text\/plain","value":"and easy to do anywhere, even with PHP"}]}' ); } } PKwf\g unit/Ip/.htaccessnu[Options -IndexesPKwf\ Jo<<unit/Ip/IpsWarmupTest.phpnu[client->ips()->warmup()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpsWarmupPostMethod() { $request_body = json_decode('{ "ip": "0.0.0.0" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->warmup()->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpsWarmupIpAddressGetMethod() { $ip_address = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->warmup()->_($ip_address)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpsWarmupIpAddressDeleteMethod() { $ip_address = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->ips()->warmup()->_($ip_address)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\)S''unit/Ip/IpsTest.phpnu[client->ips()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpsAssignedGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->assigned()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpsIpAddressGetMethod() { $ip_address = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->_($ip_address)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\ unit/Ip/IpPoolsTest.phpnu[client->ips()->pools()->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpPoolsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->pools()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpPoolsPoolNamePutMethod() { $request_body = json_decode('{ "name": "new_pool_name" }'); $pool_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->pools()->_($pool_name)->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpPoolsPoolNameGetMethod() { $pool_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->ips()->pools()->_($pool_name)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testIpPoolsPoolNameDeleteMethod() { $pool_name = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->ips()->pools()->_($pool_name)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testIpPoolsPoolNameIpsPostMethod() { $request_body = json_decode('{ "ip": "0.0.0.0" }'); $pool_name = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testIpPoolsPoolNameIpsIdDeleteMethod() { $pool_name = "test_url_param"; $ip = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\g unit/Suppression/.htaccessnu[Options -IndexesPKwf\i9kk1unit/Suppression/SuppressionInvalidEmailsTest.phpnu[client->suppression()->invalid_emails()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionInvalidEmailsDeleteMethod() { $request_body = json_decode('{ "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->invalid_emails()->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSuppressionInvalidEmailsEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->suppression()->invalid_emails()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionBouncesEmailDeleteMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->invalid_emails()->_($email)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\x"vv+unit/Suppression/SuppressionBouncesTest.phpnu[client->suppression()->bounces()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionBouncesDeleteMethod() { $request_body = json_decode('{ "delete_all": true, "emails": [ "example@example.com", "example2@example.com" ] }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->bounces()->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSuppressionBouncesEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->suppression()->bounces()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionBouncesEmailDeleteMethod() { $query_params = json_decode('{"email_address": "example@example.com"}'); $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->bounces()->_($email)->delete(null, $query_params, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\0unit/Suppression/SuppressionUnsubscribesTest.phpnu[client->suppression()->unsubscribes()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\ޛb..*unit/Suppression/SuppressionBlocksTest.phpnu[client->suppression()->blocks()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionBlocksDeleteMethod() { $request_body = json_decode('{ "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->blocks()->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSuppressionBlocksEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->suppression()->blocks()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionBlocksEmailDeleteMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->blocks()->_($email)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\3m__/unit/Suppression/SuppressionSpamReportsTest.phpnu[client->suppression()->spam_reports()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionSpamReportsDeleteMethod() { $request_body = json_decode('{ "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->spam_reports()->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSuppressionSpamReportsEmailGetMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->suppression()->spam_reports()->_($email)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSuppressionSpamReportsEmailDeleteMethod() { $email = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->suppression()->spam_reports()->_($email)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\g unit/Mail/.htaccessnu[Options -IndexesPKwf\Ïunit/Mail/MailBatchTest.phpnu[client->mail()->batch()->post(null, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testMailBatchIdGetMethod() { $batch_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail()->batch()->_($batch_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\pCCunit/Mail/MailSettingsTest.phpnu[client->mail_settings()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsAddressWhitelistPatchMethod() { $request_body = json_decode('{ "enabled": true, "list": [ "email1@example.com", "example.com" ] }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->address_whitelist()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsAddressWhitelistGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->address_whitelist()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsBccPatchMethod() { $request_body = json_decode('{ "email": "email@example.com", "enabled": false }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->bcc()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsBccGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->bcc()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsBouncePurgePatchMethod() { $request_body = json_decode('{ "enabled": true, "hard_bounces": 5, "soft_bounces": 5 }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->bounce_purge()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsBouncePurgeGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->bounce_purge()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsFooterPatchMethod() { $request_body = json_decode('{ "enabled": true, "html_content": "...", "plain_content": "..." }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->footer()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsFooterGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->footer()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsForwardBouncePatchMethod() { $request_body = json_decode('{ "email": "example@example.com", "enabled": true }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->forward_bounce()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsForwardBounceGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->forward_bounce()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsForwardSpamPatchMethod() { $request_body = json_decode('{ "email": "", "enabled": false }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->forward_spam()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsForwardSpamGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->forward_spam()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsPlainContentPatchMethod() { $request_body = json_decode('{ "enabled": false }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->plain_content()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsPlainContentGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->plain_content()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsSpamCheckPatchMethod() { $request_body = json_decode('{ "enabled": true, "max_score": 5, "url": "url" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->spam_check()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsSpamCheckGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->spam_check()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsTemplatePatchMethod() { $request_body = json_decode('{ "enabled": true, "html_content": "<% body %>" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->template()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testMailSettingsTemplateGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->mail_settings()->template()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\%1/unit/Mail/MailSendTest.phpnu[

Hello, world!

" } ], "custom_args": { "New Argument 1": "New Value 1", "activationAttempt": "1", "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" }, "from": { "email": "sam.smith@example.com", "name": "Sam Smith" }, "headers": {}, "ip_pool_name": "[YOUR POOL NAME GOES HERE]", "mail_settings": { "bcc": { "email": "ben.doe@example.com", "enable": true }, "bypass_list_management": { "enable": true }, "footer": { "enable": true, "html": "

Thanks
The SendGrid Team

", "text": "Thanks,/n The SendGrid Team" }, "sandbox_mode": { "enable": false }, "spam_check": { "enable": true, "post_to_url": "http://example.com/compliance", "threshold": 3 } }, "personalizations": [ { "bcc": [ { "email": "sam.doe@example.com", "name": "Sam Doe" } ], "cc": [ { "email": "jane.doe@example.com", "name": "Jane Doe" } ], "custom_args": { "New Argument 1": "New Value 1", "activationAttempt": "1", "customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]" }, "headers": { "X-Accept-Language": "en", "X-Mailer": "MyApp" }, "send_at": 1409348513, "subject": "Hello, World!", "substitutions": { "id": "substitutions", "type": "object" }, "to": [ { "email": "john.doe@example.com", "name": "John Doe" } ] } ], "reply_to": { "email": "sam.smith@example.com", "name": "Sam Smith" }, "sections": { "section": { ":sectionName1": "section 1 text", ":sectionName2": "section 2 text" } }, "send_at": 1409348513, "subject": "Hello, World!", "template_id": "[YOUR TEMPLATE ID GOES HERE]", "tracking_settings": { "click_tracking": { "enable": true, "enable_text": true }, "ganalytics": { "enable": true, "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]", "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]", "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]", "utm_name": "[NAME OF YOUR CAMPAIGN]", "utm_term": "[IDENTIFY PAID KEYWORDS HERE]" }, "open_tracking": { "enable": true, "substitution_tag": "%opentrack" }, "subscription_tracking": { "enable": true, "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.", "substitution_tag": "<%click here%>", "text": "If you would like to unsubscribe and stop receiving these emails <% click here %>." } } }'); $request_headers = ["X-Mock: 202"]; $response = self::$sg->client->mail()->send()->post($request_body, null, $request_headers); $this->assertEquals(202, $response->statusCode()); } } PKwf\UvZ3`O`Ounit/Mail/MailHelperTest.phpnu[some text here"); $mail->addContent($content); $json = json_encode($mail); $this->assertEquals($json, '{"from":{"email":"test@example.com"},"personalizations":[{"to":[{"email":"test@example.com"}]}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"some text here<\/body><\/html>"}]}'); } public function testKitchenSinkExample() { $from = new Email("DX", "test@example.com"); $subject = "Hello World from the SendGrid PHP Library"; $to = new Email("Example User", "test@example.com"); $content = new Content("text/plain", "some text here"); $mail = new Mail($from, $subject, $to, $content); $email = new Email("Example User", "test@example.com"); $mail->personalization[0]->addTo($email); $email = new Email("Example User", "test@example.com"); $mail->personalization[0]->addCc($email); $email = new Email("Example User", "test@example.com"); $mail->personalization[0]->addCc($email); $email = new Email("Example User", "test@example.com"); $mail->personalization[0]->addBcc($email); $email = new Email("Example User", "test@example.com"); $mail->personalization[0]->addBcc($email); $mail->personalization[0]->setSubject("Hello World from the SendGrid PHP Library"); $mail->personalization[0]->addHeader("X-Test", "test"); $mail->personalization[0]->addHeader("X-Mock", "true"); $mail->personalization[0]->addSubstitution("%name%", "Example User"); $mail->personalization[0]->addSubstitution("%city%", "Denver"); $mail->personalization[0]->addCustomArg("user_id", "343"); $mail->personalization[0]->addCustomArg("type", "marketing"); $mail->personalization[0]->setSendAt(1443636843); $personalization1 = new Personalization(); $email = new Email("Example User", "test@example.com"); $personalization1->addTo($email); $email = new Email("Example User", "test@example.com"); $personalization1->addTo($email); $email = new Email("Example User", "test@example.com"); $personalization1->addCc($email); $email = new Email("Example User", "test@example.com"); $personalization1->addCc($email); $email = new Email("Example User", "test@example.com"); $personalization1->addBcc($email); $email = new Email("Example User", "test@example.com"); $personalization1->addBcc($email); $personalization1->setSubject("Hello World from the SendGrid PHP Library"); $personalization1->addHeader("X-Test", "test"); $personalization1->addHeader("X-Mock", "true"); $personalization1->addSubstitution("%name%", "Example User"); $personalization1->addSubstitution("%city%", "Denver"); $personalization1->addCustomArg("user_id", "343"); $personalization1->addCustomArg("type", "marketing"); $personalization1->setSendAt(1443636843); $mail->addPersonalization($personalization1); $content = new Content("text/html", "some text here"); $mail->addContent($content); $attachment = new Attachment(); $attachment->setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12"); $attachment->setType("application/pdf"); $attachment->setFilename("balance_001.pdf"); $attachment->setDisposition("attachment"); $attachment->setContentId("Balance Sheet"); $mail->addAttachment($attachment); $attachment2 = new Attachment(); $attachment2->setContent("BwdW"); $attachment2->setType("image/png"); $attachment2->setFilename("banner.png"); $attachment2->setDisposition("inline"); $attachment2->setContentId("Banner"); $mail->addAttachment($attachment2); $attachment3 = new Attachment(); $attachment3->setContentPath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'test.txt'); $attachment3->setType('text/plain'); $attachment3->setDisposition('attachment'); $attachment3->setContentID('My text'); $mail->addAttachment($attachment3); $mail->setTemplateId("439b6d66-4408-4ead-83de-5c83c2ee313a"); $mail->addSection("%section1%", "Substitution Text for Section 1"); $mail->addSection("%section2%", "Substitution Text for Section 2"); $mail->addHeader("X-Test1", "1"); $mail->addHeader("X-Test2", "2"); $mail->addCategory("May"); $mail->addCategory("2016"); $mail->addCustomArg("campaign", "welcome"); $mail->addCustomArg("weekday", "morning"); $mail->setSendAt(1443636842); $asm = new ASM(); $asm->setGroupId(99); $asm->setGroupsToDisplay([4,5,6,7,8]); $mail->setASM($asm); $mail->setIpPoolName("23"); $mail_settings = new MailSettings(); $bcc_settings = new BccSettings(); $bcc_settings->setEnable(true); $bcc_settings->setEmail("test@example.com"); $mail_settings->setBccSettings($bcc_settings); $sandbox_mode = new SandBoxMode(); $sandbox_mode->setEnable(true); $mail_settings->setSandboxMode($sandbox_mode); $bypass_list_management = new BypassListManagement(); $bypass_list_management->setEnable(true); $mail_settings->setBypassListManagement($bypass_list_management); $footer = new Footer(); $footer->setEnable(true); $footer->setText("Footer Text"); $footer->setHtml("Footer Text"); $mail_settings->setFooter($footer); $spam_check = new SpamCheck(); $spam_check->setEnable(true); $spam_check->setThreshold(1); $spam_check->setPostToUrl("https://spamcatcher.sendgrid.com"); $mail_settings->setSpamCheck($spam_check); $mail->setMailSettings($mail_settings); $tracking_settings = new TrackingSettings(); $click_tracking = new ClickTracking(); $click_tracking->setEnable(true); $click_tracking->setEnableText(true); $tracking_settings->setClickTracking($click_tracking); $open_tracking = new OpenTracking(); $open_tracking->setEnable(true); $open_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); $tracking_settings->setOpenTracking($open_tracking); $subscription_tracking = new SubscriptionTracking(); $subscription_tracking->setEnable(true); $subscription_tracking->setText("text to insert into the text/plain portion of the message"); $subscription_tracking->setHtml("html to insert into the text/html portion of the message"); $subscription_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message"); $tracking_settings->setSubscriptionTracking($subscription_tracking); $ganalytics = new Ganalytics(); $ganalytics->setEnable(true); $ganalytics->setCampaignSource("some source"); $ganalytics->setCampaignTerm("some term"); $ganalytics->setCampaignContent("some content"); $ganalytics->setCampaignName("some name"); $ganalytics->setCampaignMedium("some medium"); $tracking_settings->setGanalytics($ganalytics); $mail->setTrackingSettings($tracking_settings); $reply_to = new ReplyTo("test@example.com", "Optional Name"); $mail->setReplyTo($reply_to); $json = json_encode($mail); $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"},{"content":"aGVsbG8K","type":"text\/plain","filename":"test.txt","disposition":"attachment","content_id":"My text"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com","name":"Optional Name"}}'); $reply_to = new ReplyTo("test@example.com"); $mail->setReplyTo($reply_to); $json = json_encode($mail); $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"},{"content":"aGVsbG8K","type":"text\/plain","filename":"test.txt","disposition":"attachment","content_id":"My text"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com"}}'); $reply_to = new ReplyTo("test@example.com", null); $mail->setReplyTo($reply_to); $json = json_encode($mail); $this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\/plain","value":"some text here"},{"type":"text\/html","value":"some text here<\/body><\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"},{"content":"aGVsbG8K","type":"text\/plain","filename":"test.txt","disposition":"attachment","content_id":"My text"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"Footer Text<\/body><\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\/\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\/plain portion of the message","html":"html to insert into the text\/html portion of the message<\/body><\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com"}}'); } public function testEmailName() { $email = new Email('John Doe', 'test@example.com'); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"name":"John Doe","email":"test@example.com"}'); $email->setName(''); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"email":"test@example.com"}'); $email->setName(null); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"email":"test@example.com"}'); $email->setName('Doe, John'); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"name":"\\"Doe, John\\"","email":"test@example.com"}'); $email->setName('Doe; John'); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"name":"\\"Doe; John\\"","email":"test@example.com"}'); $email->setName('John "Billy" O\'Keeffe'); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"name":"John \\"Billy\\" O\'Keeffe","email":"test@example.com"}'); $email->setName('O\'Keeffe, John "Billy"'); $json = json_encode($email->jsonSerialize()); $this->assertEquals($json, '{"name":"\\"O\'Keeffe, John \\\\\\"Billy\\\\\\"\\"","email":"test@example.com"}'); } } PKwf\@"unit/Mail/MailboxProvidersTest.phpnu[client->mailbox_providers() ->stats() ->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Whitelabel/.htaccessnu[Options -IndexesPKwf\9m'unit/Whitelabel/WhitelabelLinksTest.phpnu[client->whitelabel()->links()->post($request_body, $query_params, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testWhitelabelLinksGetMethod() { $query_params = json_decode('{"limit": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksDefaultGetMethod() { $query_params = json_decode('{"domain": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->default()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksSubUserGetMethod() { $query_params = json_decode('{"username": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->subuser()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksSubUserDeleteMethod() { $query_params = json_decode('{"username": "test_string"}'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->whitelabel()->links()->subuser()->delete(null, $query_params, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testWhitelabelLinksIdPatchMethod() { $request_body = json_decode('{ "default": true }'); $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->_($id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksIdGetMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->_($id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksIdDeleteMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->whitelabel()->links()->_($id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testWhitelabelLinksIdValidatePostMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->_($id)->validate()->post(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelLinksIdSubUserPostMethod() { $request_body = json_decode('{ "username": "jane@example.com" }'); $link_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->links()->_($link_id)->subuser()->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\9R6%unit/Whitelabel/WhitelabelIpsTest.phpnu[client->whitelabel()->ips()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testWhitelabelIpsGetMethod() { $query_params = json_decode('{"ip": "test_string", "limit": 1, "offset": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->ips()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelIpsIdGetMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->ips()->_($id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelIpsIdDeleteMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->whitelabel()->ips()->_($id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testWhitelabelIpsIdValidatePostMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->ips()->_($id)->validate()->post(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\z`)unit/Whitelabel/WhitelabelDomainsTest.phpnu[client->whitelabel()->domains()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testWhitelabelDomainsGetMethod() { $query_params = json_decode('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsDefaultGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->default()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsSubUserGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->subuser()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsSubUserDeleteMethod() { $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->whitelabel()->domains()->subuser()->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testWhitelabelDomainsIdPatchMethod() { $request_body = json_decode('{ "custom_spf": true, "default": false }'); $domain_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsIdGetMethod() { $domain_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsIdDeleteMethod() { $domain_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testWhitelabelDomainsIdSubUserPostMethod() { $request_body = json_decode('{ "username": "jane@example.com" }'); $domain_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->whitelabel()->domains()->_($domain_id)->subuser() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testWhitelabelDomainsIdIpsPostMethod() { $request_body = json_decode('{ "ip": "192.168.0.1" }'); $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsIdIpsDeleteMethod() { $id = "test_url_param"; $ip = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->_($ip)->delete(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testWhitelabelDomainsIdValidatePostMethod() { $id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->whitelabel()->domains()->_($id)->validate()->post(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Users/.htaccessnu[Options -IndexesPKwf\:8%8%unit/Users/UserTest.phpnu[client->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserAccountGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->account()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserCreditsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->credits()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserEmailPutMethod() { $request_body = json_decode('{ "email": "example@example.com" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->email()->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserEmailGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->email()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserPasswordPutMethod() { $request_body = json_decode('{ "new_password": "new_password", "old_password": "old_password" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->password()->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserProfilePatchMethod() { $request_body = json_decode('{ "city": "Orange", "first_name": "Example", "last_name": "User" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->profile()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserProfileGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->profile()->get(null, null, $request_headers); $this->assertEquals($response->statusCode(), 200); } public function testUserScheduledSendsPostMethod() { $request_body = json_decode('{ "batch_id": "YOUR_BATCH_ID", "status": "pause" }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->user()->scheduled_sends()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testUserScheduledSendsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->scheduled_sends()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserScheduledSendsBatchIdPatchMethod() { $request_body = json_decode('{ "status": "pause" }'); $batch_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->patch( $request_body, null, $request_headers ); $this->assertEquals(204, $response->statusCode()); } public function testUserScheduledSendsBatchIdGetMethod() { $batch_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserScheduledSendsBatchIdDeleteMethod() { $batch_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testUserSettingsEnforcedTlsPatchMethod() { $request_body = json_decode('{ "require_tls": true, "require_valid_cert": false }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->settings()->enforced_tls()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserSettingsEnforcedTlsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->settings()->enforced_tls()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserUsernamePutMethod() { $request_body = json_decode('{ "username": "test_username" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->username()->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserUsernameGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->username()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksEventSettingsPatchMethod() { $request_body = json_decode('{ "bounce": true, "click": true, "deferred": true, "delivered": true, "dropped": true, "enabled": true, "group_resubscribe": true, "group_unsubscribe": true, "open": true, "processed": true, "spam_report": true, "unsubscribe": true, "url": "url" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->event()->settings()->patch( $request_body, null, $request_headers ); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksEventSettingsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->event()->settings()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksEventTestPostMethod() { $request_body = json_decode('{ "url": "url" }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->user()->webhooks()->event()->test()->post($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testUserWebhooksParseSettingsPostMethod() { $request_body = json_decode('{ "hostname": "myhostname.com", "send_raw": false, "spam_check": true, "url": "http://email.myhosthame.com" }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->user()->webhooks()->parse()->settings()->post( $request_body, null, $request_headers ); $this->assertEquals(201, $response->statusCode()); } public function testUserWebhooksParseSettingsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->parse()->settings()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksParseHostnamePatchMethod() { $request_body = json_decode('{ "send_raw": true, "spam_check": false, "url": "http://newdomain.com/parse" }'); $hostname = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname) ->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksParseHostnameGetMethod() { $hostname = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get( null, null, $request_headers ); $this->assertEquals(200, $response->statusCode()); } public function testUserWebhooksParseHostnameDeleteMethod() { $hostname = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete( null, null, $request_headers ); $this->assertEquals(204, $response->statusCode()); } public function testUserWebhooksParseStatsGetMethod() { $query_params = json_decode('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Categories/.htaccessnu[Options -IndexesPKwf\TԌ"unit/Categories/CategoriesTest.phpnu[client->categories()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCategoriesStatsGetMethod() { $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->categories()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testCategoriesStatsSumsGetMethod() { $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->categories()->stats()->sums()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Subusers/.htaccessnu[Options -IndexesPKwf\܃unit/Subusers/SubUsersTest.phpnu[client->subusers()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersPostMethod() { $request_body = json_decode('{ "email": "John@example.com", "ips": [ "1.1.1.1", "2.2.2.2" ], "password": "johns_password", "username": "John@example.com" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->post($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersReputationGetMethod() { $query_params = json_decode('{"usernames": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->reputations()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersStatsGetMethod() { $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->stats()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersStatsMonthlyGetMethod() { $query_params = json_decode('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->stats()->monthly()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersStatsSumsGetMethod() { $query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->stats()->sums()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersNamePatchMethod() { $request_body = json_decode('{ "disabled": false }'); $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->subusers()->_($subuser_name)->patch($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSubUsersNameDeleteMethod() { $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->subusers()->_($subuser_name)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSubUsersNameIpsPutMethod() { $request_body = json_decode('[ "127.0.0.1" ]'); $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->_($subuser_name)->ips()->put($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersNameMonitorPutMethod() { $request_body = json_decode('{ "email": "example@example.com", "frequency": 500 }'); $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->put( $request_body, null, $request_headers ); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersNameMonitorPostMethod() { $request_body = json_decode('{ "email": "example@example.com", "frequency": 50000 }'); $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->post( $request_body, null, $request_headers ); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersNameMonitorGetMethod() { $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSubUsersNameMonitorDeleteMethod() { $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->subusers()->_($subuser_name)->monitor()->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSubUsersNameStatsMonthlyGetMethod() { $query_params = json_decode('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}'); $subuser_name = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->subusers()->_($subuser_name)->stats()->monthly()->get( null, $query_params, $request_headers ); $this->assertEquals(200, $response->statusCode()); } } PKwf\g unit/Templates/.htaccessnu[Options -IndexesPKwf\TSS unit/Templates/TemplatesTest.phpnu[client->templates()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testTemplatesGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTemplatesIdPatchMethod() { $request_body = json_decode('{ "name": "new_example_name" }'); $template_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->_($template_id)->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTemplatesIdGetMethod() { $template_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->_($template_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTemplatesIdDeleteMethod() { $template_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->templates()->_($template_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testTemplatesIdVersionsPostMethod() { $request_body = json_decode('{ "active": 1, "html_content": "<%body%>", "name": "example_version_name", "plain_content": "<%body%>", "subject": "<%subject%>", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543" }'); $template_id = "test_url_param"; $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->templates()->_($template_id)->versions()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testTemplatesIdVersionsIdPatchMethod() { $request_body = json_decode('{ "active": 1, "html_content": "<%body%>", "name": "updated_example_name", "plain_content": "<%body%>", "subject": "<%subject%>" }'); $template_id = "test_url_param"; $version_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id) ->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTemplatesIdVersionsIdGetMethod() { $template_id = "test_url_param"; $version_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTemplatesIdVersionsIdDeleteMethod() { $template_id = "test_url_param"; $version_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id) ->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testTemplatesIdVersionsIdActivatePostMethod() { $template_id = "test_url_param"; $version_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->activate() ->post(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\n:ounit/phpunit.xml.distnu[ . PKwf\g unit/helpers/.htaccessnu[Options -IndexesPKwf\g unit/helpers/contacts/.htaccessnu[Options -IndexesPKwf\(unit/helpers/contacts/RecipientsTest.phpnu[assertEquals( $form, '
First Name:
Last Name:
E-mail:
' ); } public function testRecipientsFormSubmit() { $firstName = 'Test'; $lastName = 'Tester'; $email = 'test@test.com'; $recipient = new Recipient($firstName, $lastName, $email); $json = json_encode($recipient); $this->assertEquals($json, '{"email":"test@test.com","first_name":"Test","last_name":"Tester"}'); } } PKwf\H"" unit/helpers/stats/StatsTest.phpnu[assertEquals($expectedGlobal, $userStats->getGlobal()); $this->assertEquals($expectedCategory, $userStats->getCategory($expectedCategory['categories'])); $this->assertEquals($expectedSubuser, $userStats->getSubuser($expectedSubuser['subusers'])); $this->assertEquals($expectedSum, $userStats->getSum( $expectedSum['sort_by_metric'], $expectedSum['sort_by_direction'], $expectedSum['limit'], $expectedSum['offset'] )); $this->assertEquals($expectedSubuserMonthly, $userStats->getSubuserMonthly( $expectedSubuserMonthly['subuser'], $expectedSubuserMonthly['sort_by_metric'], $expectedSubuserMonthly['sort_by_direction'], $expectedSubuserMonthly['limit'], $expectedSubuserMonthly['offset'] )); } /** * @param array $expectedGlobal * @param array $expectedCategory * @param array $expectedSubuser * @param array $expectedSum * @param array $expectedSubuserMonthly * @dataProvider invalidValues * @expectedException Exception */ public function testGetValuesFail( $expectedGlobal, $expectedCategory, $expectedSubuser, $expectedSum, $expectedSubuserMonthly ) { $this->testGetValues( $expectedGlobal, $expectedCategory, $expectedSubuser, $expectedSum, $expectedSubuserMonthly ); } public function validValues() { return [ [ $this->getExpectedGlobal('1980-01-01', null, null), $this->getExpectedCategory('1980-01-01', null, null, ['cat1', 'cat2']), $this->getExpectedSubuser('1980-01-01', null, null, ['user1', 'user2']), $this->getExpectedSum('1980-01-01', null, null, 'delivered', 'desc', 5, 0), $this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'desc', 5, 0), ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', null), $this->getExpectedCategory('1980-01-01', '2017-01-01', null, ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', null, ['user1']), $this->getExpectedSum('1980-01-01', '2017-01-01', null, 'delivered', 'asc', 10, 2), $this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 10, 2), ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', ['user1']), $this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', 50, 6), $this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 50, 6), ], ]; } public function invalidValues() { return [ [ $this->getExpectedGlobal(null, null, null), null, null, null, null ], [ $this->getExpectedGlobal('1980-01-0145', null, null), null, null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '1980-01-0145', null), null, null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '1980-01-02', 'asdf'), null, null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', null), null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', null), null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', []), null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['a' => 'b']), null, null, null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null), $this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', null, 50, 6), null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null), $this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asdf', 50, 6), null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null), $this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', null, 'asdf'), null ], [ $this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'), $this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']), $this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', ['user1']), $this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', 50, 6), $this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 50, null), ], ]; } public function getExpectedGlobal($startDate, $endDate, $aggregatedBy) { return [ 'start_date' => $startDate, 'end_date' => $endDate, 'aggregated_by' => $aggregatedBy, ]; } public function getExpectedCategory($startDate, $endDate, $aggregatedBy, $categories) { return [ 'start_date' => $startDate, 'end_date' => $endDate, 'aggregated_by' => $aggregatedBy, 'categories' => $categories ]; } public function getExpectedSubuser($startDate, $endDate, $aggregatedBy, $subusers) { return [ 'start_date' => $startDate, 'end_date' => $endDate, 'aggregated_by' => $aggregatedBy, 'subusers' => $subusers ]; } public function getExpectedSum($startDate, $endDate, $aggregatedBy, $sortByMetric, $sortByDirection, $limit, $offset) { return [ 'start_date' => $startDate, 'end_date' => $endDate, 'aggregated_by' => $aggregatedBy, 'sort_by_metric' => $sortByMetric, 'sort_by_direction' => $sortByDirection, 'limit' => $limit, 'offset' => $offset ]; } public function getExpectedSubuserMonthly($date, $subuser, $sortByMetric, $sortByDirection, $limit, $offset) { return [ 'date' => $date, 'subuser' => $subuser, 'sort_by_metric' => $sortByMetric, 'sort_by_direction' => $sortByDirection, 'limit' => $limit, 'offset' => $offset ]; } } PKwf\g unit/helpers/stats/.htaccessnu[Options -IndexesPKwf\g unit/Senders/.htaccessnu[Options -IndexesPKwf\t unit/Senders/SendersTest.phpnu[client->senders() ->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testSendersGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->senders() ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSendersIdPatchMethod() { $request_body = json_decode('{ "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "country": "United States", "from": { "email": "from@example.com", "name": "Example INC" }, "nickname": "My Sender ID", "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "state": "Colorado", "zip": "80202" }'); $sender_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->senders() ->_($sender_id) ->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSendersIdGetMethod() { $sender_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->senders() ->_($sender_id) ->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testSendersIdDeleteMethod() { $sender_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->senders() ->_($sender_id) ->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testSendersIdResendVerificationPostMethod() { $sender_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->senders() ->_($sender_id) ->resend_verification() ->post(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKwf\g unit/Settings/.htaccessnu[Options -IndexesPKwf\Eu%unit/Settings/PartnerSettingsTest.phpnu[client->partner_settings()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testPartnerSettingsNewRelicPatchMethod() { $request_body = json_decode('{ "enable_subuser_statistics": true, "enabled": true, "license_key": "" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->partner_settings()->new_relic()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testPartnerSettingsNewRelicGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->partner_settings()->new_relic()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\:  &unit/Settings/TrackingSettingsTest.phpnu[client->tracking_settings()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsClickPatchMethod() { $request_body = json_decode('{ "enabled": true }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->click()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsClickGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->click()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsGoogleAnalyticsPatchMethod() { $request_body = json_decode('{ "enabled": true, "utm_campaign": "website", "utm_content": "", "utm_medium": "email", "utm_source": "sendgrid.com", "utm_term": "" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->google_analytics()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsGoogleAnalyticsGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->google_analytics()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsOpenPatchMethod() { $request_body = json_decode('{ "enabled": true }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->open()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsOpenGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->open()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsSubscriptionPatchMethod() { $request_body = json_decode('{ "enabled": true, "html_content": "html content", "landing": "landing page html", "plain_content": "text content", "replace": "replacement tag", "url": "url" }'); $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->subscription()->patch($request_body, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testTrackingSettingsSubscriptionGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->tracking_settings()->subscription()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } } PKwf\w3$unit/Settings/AccessSettingsTest.phpnu[ 1 ]; $request_headers = ['X-Mock: 200']; $response = self::$sg->client->access_settings()->activity()->get(null, $query_params, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAccessSettingsWhitelistPostMethod() { $request_body = json_decode('{ "ips": [ { "ip": "192.168.1.1" }, { "ip": "192.*.*.*" }, { "ip": "192.168.1.3/32" } ] }'); $request_headers = ["X-Mock: 201"]; $response = self::$sg->client->access_settings()->whitelist()->post($request_body, null, $request_headers); $this->assertEquals(201, $response->statusCode()); } public function testAccessSettingsWhitelistGetMethod() { $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->access_settings()->whitelist()->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAccessSettingsWhitelistDeleteMethod() { $request_body = json_decode('{ "ids": [ 1, 2, 3 ] }'); $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->access_settings()->whitelist()->delete($request_body, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } public function testAccessSettingsWhitelistRuleIdGetMethod() { $rule_id = "test_url_param"; $request_headers = ["X-Mock: 200"]; $response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->get(null, null, $request_headers); $this->assertEquals(200, $response->statusCode()); } public function testAccessSettingsWhitelistRuleIdDeleteMethod() { $rule_id = "test_url_param"; $request_headers = ["X-Mock: 204"]; $response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->delete(null, null, $request_headers); $this->assertEquals(204, $response->statusCode()); } } PKjn\g  .htaccessnu[PKjn\,ЮcIunit/MockClient.phpnu[PKjn\?abbCunit/FilesExistTest.phpnu[PKjn\g unit/.htaccessnu[PKjn\:T``:unit/ClientTest.phpnu[PKjn\7|&unit/ResponseTest.phpnu[PKjn\12u,unit/LicenceYearTest.phpnu[PKjn\_/phpunit.xml.distnu[PK\UB4: : 0mailpit_message_user.phpnu[PK\q-U  a:email_catcher.phpnu[PK\FHcc @message.phpnu[PK\X0KImailpit_message.phpnu[PK\]fmessage_user.phpnu[PK\6Qkmailpit_email_catcher.phpnu[PK\(SSytest_helpers.jsnu[PK\ 3ff ,index.htmlnu[PKwf\FsQmm)prism.shnu[PKwf\g q.data/.htaccessnu[PKwf\ 0:6 .data/test.txtnu[PKwf\g /unit/ApiKeys/.htaccessnu[PKwf\X/unit/ApiKeys/ApiKeysTest.phpnu[PKwf\g 8unit/Alerts/.htaccessnu[PKwf\E"S8unit/Alerts/AlertsTest.phpnu[PKwf\t4@unit/Asm/AsmGroupsTest.phpnu[PKwf\g Nunit/Asm/.htaccessnu[PKwf\08Ounit/Asm/AsmSuppressionTest.phpnu[PKwf\g ~Vunit/Scopes/.htaccessnu[PKwf\{nnVunit/Scopes/ScopesTest.phpnu[PKwf\g Xunit/Campaigns/.htaccessnu[PKwf\ Xunit/Campaigns/CampaignsTest.phpnu[PKwf\w1LPPkunit/Stats/BrowserStatsTest.phpnu[PKwf\hnunit/Stats/StatsTest.phpnu[PKwf\g punit/Stats/.htaccessnu[PKwf\ݏ;qunit/Stats/DevicesStatsTest.phpnu[PKwf\Y&!!rsunit/Stats/GeoStatsTest.phpnu[PKwf\@uunit/Stats/ClientsStatsTest.phpnu[PKwf\g yunit/Contacts/.htaccessnu[PKwf\P<<Mzunit/Contacts/ContactDbTest.phpnu[PKwf\]B B unit/BaseTestClass.phpnu[PKwf\AZZunit/GenericTest.phpnu[PKwf\g unit/Ip/.htaccessnu[PKwf\ Jo<<unit/Ip/IpsWarmupTest.phpnu[PKwf\)S''unit/Ip/IpsTest.phpnu[PKwf\ unit/Ip/IpPoolsTest.phpnu[PKwf\g unit/Suppression/.htaccessnu[PKwf\i9kk1;unit/Suppression/SuppressionInvalidEmailsTest.phpnu[PKwf\x"vv+unit/Suppression/SuppressionBouncesTest.phpnu[PKwf\0unit/Suppression/SuppressionUnsubscribesTest.phpnu[PKwf\ޛb..*Munit/Suppression/SuppressionBlocksTest.phpnu[PKwf\3m__/unit/Suppression/SuppressionSpamReportsTest.phpnu[PKwf\g unit/Mail/.htaccessnu[PKwf\Ïunit/Mail/MailBatchTest.phpnu[PKwf\pCCunit/Mail/MailSettingsTest.phpnu[PKwf\%1/ounit/Mail/MailSendTest.phpnu[PKwf\UvZ3`O`OY*unit/Mail/MailHelperTest.phpnu[PKwf\@"zunit/Mail/MailboxProvidersTest.phpnu[PKwf\g |unit/Whitelabel/.htaccessnu[PKwf\9m'R}unit/Whitelabel/WhitelabelLinksTest.phpnu[PKwf\9R6%Tunit/Whitelabel/WhitelabelIpsTest.phpnu[PKwf\z`)unit/Whitelabel/WhitelabelDomainsTest.phpnu[PKwf\g  unit/Users/.htaccessnu[PKwf\:8%8%_unit/Users/UserTest.phpnu[PKwf\g unit/Categories/.htaccessnu[PKwf\TԌ"7unit/Categories/CategoriesTest.phpnu[PKwf\g unit/Subusers/.htaccessnu[PKwf\܃lunit/Subusers/SubUsersTest.phpnu[PKwf\g unit/Templates/.htaccessnu[PKwf\TSS 1unit/Templates/TemplatesTest.phpnu[PKwf\n:ounit/phpunit.xml.distnu[PKwf\g  unit/helpers/.htaccessnu[PKwf\g _unit/helpers/contacts/.htaccessnu[PKwf\(unit/helpers/contacts/RecipientsTest.phpnu[PKwf\H"" unit/helpers/stats/StatsTest.phpnu[PKwf\g #unit/helpers/stats/.htaccessnu[PKwf\g /$unit/Senders/.htaccessnu[PKwf\t $unit/Senders/SendersTest.phpnu[PKwf\g 0unit/Settings/.htaccessnu[PKwf\Eu%1unit/Settings/PartnerSettingsTest.phpnu[PKwf\:  &6unit/Settings/TrackingSettingsTest.phpnu[PKwf\w3$\Cunit/Settings/AccessSettingsTest.phpnu[PKPPL