mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-26 23:06:06 +03:00
dd7c1d2361
Declare strict and no superfluous phpdoc
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Copyright (C) 2013 Mailgun
|
|
*
|
|
* This software may be modified and distributed under the terms
|
|
* of the MIT license. See the LICENSE file for details.
|
|
*/
|
|
|
|
namespace Mailgun\Tests\Api;
|
|
|
|
use Mailgun\Api\Attachment;
|
|
use Mailgun\Exception\InvalidArgumentException;
|
|
use Mailgun\Model\Attachment\Attachment as Model;
|
|
|
|
class AttachmentTest extends TestCase
|
|
{
|
|
protected function getApiClass()
|
|
{
|
|
return Attachment::class;
|
|
}
|
|
|
|
public function testShow()
|
|
{
|
|
$uri = 'https://api.mailgun.org/v2/domains/mydomain.com/messages/WyJhOTM2NDk1ODA3Iiw/attachments/0';
|
|
$this->setRequestMethod('GET');
|
|
$this->setHydrateClass(Model::class);
|
|
$this->setRequestUri($uri);
|
|
|
|
$api = $this->getApiInstance();
|
|
$api->show($uri);
|
|
}
|
|
|
|
public function testShowWrongUri()
|
|
{
|
|
$api = $this->getApiInstance();
|
|
$this->expectException(InvalidArgumentException::class);
|
|
$api->show('https://api.mailgun.org/v2/domains/mydomain.com');
|
|
}
|
|
|
|
public function testShowNonMailgunUri()
|
|
{
|
|
$api = $this->getApiInstance();
|
|
$this->expectException(InvalidArgumentException::class);
|
|
$api->show('https://example.com/v2/domains/mailgun.net?x=attachments/0');
|
|
}
|
|
}
|