kinglozzer /
silverstripe-mailgunner
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Kinglozzer\SilverStripeMailgunner\Tests; |
||
| 4 | |||
| 5 | use Kinglozzer\SilverStripeMailgunner\Mailer; |
||
| 6 | use Config; |
||
| 7 | use Email; |
||
| 8 | use Injector; |
||
| 9 | |||
| 10 | class MailerTest extends \SapphireTest |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param object &$object |
||
| 14 | * @param string $methodName |
||
| 15 | * @param array $parameters |
||
| 16 | * @return mixed |
||
| 17 | */ |
||
| 18 | protected function invokeMethod(&$object, $methodName, array $parameters = []) |
||
| 19 | { |
||
| 20 | $reflection = new \ReflectionClass(get_class($object)); |
||
| 21 | $method = $reflection->getMethod($methodName); |
||
| 22 | $method->setAccessible(true); |
||
| 23 | |||
| 24 | return $method->invokeArgs($object, $parameters); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Simple test to check that registering the mailer as an Injector service |
||
| 29 | * will make it the default mailer used by Email |
||
| 30 | */ |
||
| 31 | public function testMailerRegistrationWithEmail() |
||
| 32 | { |
||
| 33 | Injector::nest(); |
||
| 34 | Injector::inst()->registerService(new Mailer, 'Mailer'); |
||
| 35 | $this->assertInstanceOf('Kinglozzer\SilverStripeMailgunner\Mailer', Email::mailer()); |
||
|
0 ignored issues
–
show
|
|||
| 36 | |||
| 37 | Injector::unnest(); |
||
| 38 | $this->assertNotInstanceOf('Kinglozzer\SilverStripeMailgunner\Mailer', Email::mailer()); |
||
|
0 ignored issues
–
show
The method
assertNotInstanceOf() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 39 | } |
||
| 40 | |||
| 41 | public function testSetGetMailgunClient() |
||
| 42 | { |
||
| 43 | $mailer = new Mailer; |
||
| 44 | $mockClient = $this->getMock('Mailgun\Mailgun'); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 45 | |||
| 46 | $this->assertInstanceOf('Mailgun\Mailgun', $mailer->getMailgunClient()); |
||
|
0 ignored issues
–
show
The method
assertInstanceOf() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 47 | |||
| 48 | $mailer->setMailgunClient($mockClient); |
||
| 49 | $this->assertSame($mockClient, $mailer->getMailgunClient()); |
||
|
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | protected function getMockEmail() |
||
| 56 | { |
||
| 57 | return [ |
||
| 58 | '"Foo Smith" <[email protected]>', // to |
||
| 59 | '"Baz Smith" <[email protected]>', // from |
||
| 60 | 'Important question', // subject |
||
| 61 | '<p>How much foo could a foo bar baz if a baz bam could bar foo?</p>', // html content |
||
| 62 | 'How much foo could a foo bar baz if a baz bam could bar foo?', // plain text content |
||
| 63 | [ |
||
| 64 | [ |
||
| 65 | 'filename' => 'filename.jpg', |
||
| 66 | 'contents' => 'abcdefg' |
||
| 67 | ] |
||
| 68 | ], // attachments |
||
| 69 | [ |
||
| 70 | 'X-Custom-Header' => 'foo', |
||
| 71 | 'Cc' => '[email protected]', |
||
| 72 | 'Bcc' => '[email protected]' |
||
| 73 | ] // headers |
||
| 74 | ]; |
||
| 75 | } |
||
| 76 | |||
| 77 | View Code Duplication | public function testSendPlain() |
|
| 78 | { |
||
| 79 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 80 | |||
| 81 | $mailer = $this->getMock('Kinglozzer\SilverStripeMailgunner\Mailer', ['sendMessage']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 82 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 83 | ->method('sendMessage') |
||
| 84 | ->with( |
||
| 85 | $this->equalTo($to), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 86 | $this->equalTo($from), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 87 | $this->equalTo($subject), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 88 | $this->equalTo(''), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 89 | $this->equalTo($plainContent), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 90 | $this->equalTo($attachments), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 91 | $this->equalTo($headers) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 92 | ); |
||
| 93 | |||
| 94 | $mailer->sendPlain($to, $from, $subject, $plainContent, $attachments, $headers); |
||
| 95 | } |
||
| 96 | |||
| 97 | View Code Duplication | public function testSendHTML() |
|
| 98 | { |
||
| 99 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 100 | |||
| 101 | $mailer = $this->getMock('Kinglozzer\SilverStripeMailgunner\Mailer', ['sendMessage']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 102 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 103 | ->method('sendMessage') |
||
| 104 | ->with( |
||
| 105 | $this->equalTo($to), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 106 | $this->equalTo($from), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 107 | $this->equalTo($subject), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 108 | $this->equalTo($content), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 109 | $this->equalTo($plainContent), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 110 | $this->equalTo($attachments), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 111 | $this->equalTo($headers) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 112 | ); |
||
| 113 | |||
| 114 | $mailer->sendHTML($to, $from, $subject, $content, $attachments, $headers, $plainContent); |
||
| 115 | } |
||
| 116 | |||
| 117 | public function testSendMessage() |
||
| 118 | { |
||
| 119 | $domain = 'http://testdomain.com'; |
||
| 120 | Config::inst()->update('Kinglozzer\SilverStripeMailgunner\Mailer', 'api_domain', $domain); |
||
| 121 | |||
| 122 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 123 | $preparedattachments = [ |
||
| 124 | ['filePath' => '/foo/bar/baz', 'remoteName' => 'image.jpg'] |
||
| 125 | ]; |
||
| 126 | |||
| 127 | $messageBuilder = $this->getMock('Mailgun\Messages\MessageBuilder', ['getMessage', 'getFiles']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 128 | // We expect that sendMessage() will fetch the full message text from the builder |
||
| 129 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 130 | ->method('getMessage') |
||
| 131 | ->will($this->returnValue('test message')); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 132 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 133 | ->method('getFiles') |
||
| 134 | ->will($this->returnValue('attachedfiles')); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 135 | |||
| 136 | $client = $this->getMock('Mailgun\Mailgun', ['MessageBuilder', 'sendMessage']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 137 | // We expect that sendMessage() will fetch the message builder from the Mailgun client, and |
||
| 138 | // we use this point to inject our mock message builder |
||
| 139 | $client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 140 | ->method('MessageBuilder') |
||
| 141 | ->will($this->returnValue($messageBuilder)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 142 | // We expect that Mailer::sendMessage() will trigger Mailgun::sendMessage() with the |
||
| 143 | // domain set in config, and the prepared message and attachments |
||
| 144 | $client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 145 | ->method('sendMessage') |
||
| 146 | ->with( |
||
| 147 | $this->equalTo($domain), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 148 | $this->equalTo('test message'), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 149 | $this->equalTo('attachedfiles') |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 150 | ); |
||
| 151 | |||
| 152 | $mailer = $this->getMock( |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 153 | 'Kinglozzer\SilverStripeMailgunner\Mailer', |
||
| 154 | ['getMailgunClient', 'buildMessage', 'prepareAttachments', 'closeTempFileHandles'] |
||
| 155 | ); |
||
| 156 | // We inject our mock Mailgun client while asserting that sendMessage() does request it |
||
| 157 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 158 | ->method('getMailgunClient') |
||
| 159 | ->will($this->returnValue($client)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 160 | // We've got attachments, so we assert that sendMessage() passes them off to |
||
| 161 | // prepareAttachments() and specify a mock "prepared" return value |
||
| 162 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 163 | ->method('prepareAttachments') |
||
| 164 | ->with($this->equalTo($attachments)) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 165 | ->will($this->returnValue($preparedattachments)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 166 | // We expect that sendMessage() will pass everything off to the buildMessage() method |
||
| 167 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 168 | ->method('buildMessage') |
||
| 169 | ->with( |
||
| 170 | $this->equalTo($messageBuilder), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 171 | $this->equalTo($to), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 172 | $this->equalTo($from), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 173 | $this->equalTo($subject), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 174 | $this->equalTo($content), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 175 | $this->equalTo($plainContent), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 176 | $this->equalTo($preparedattachments), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 177 | $this->equalTo($headers) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 178 | ); |
||
| 179 | // Assert that the mailer attempts to close any remaining open file handles |
||
| 180 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 181 | ->method('closeTempFileHandles'); |
||
| 182 | |||
| 183 | // Let's go! |
||
| 184 | $this->invokeMethod( |
||
| 185 | $mailer, |
||
| 186 | 'sendMessage', |
||
| 187 | [$to, $from, $subject, $content, $plainContent, $attachments, $headers] |
||
| 188 | ); |
||
| 189 | } |
||
| 190 | |||
| 191 | public function testSendMessageBatch() |
||
| 192 | { |
||
| 193 | $domain = 'http://testdomain.com'; |
||
| 194 | Config::inst()->update('Kinglozzer\SilverStripeMailgunner\Mailer', 'api_domain', $domain); |
||
| 195 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 196 | |||
| 197 | $preparedattachments = [ |
||
| 198 | ['filePath' => '/foo/bar/baz', 'remoteName' => 'image.jpg'] |
||
| 199 | ]; |
||
| 200 | |||
| 201 | $messageBuilder = $this->getMockBuilder('Mailgun\Messages\BatchMessage') |
||
|
0 ignored issues
–
show
The method
getMockBuilder() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 202 | ->disableOriginalConstructor() |
||
| 203 | ->setMethods(['finalize']) |
||
| 204 | ->getMock(); |
||
| 205 | // We expect that finalize() will be called to send any remaining messages in the queue |
||
| 206 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 207 | ->method('finalize'); |
||
| 208 | |||
| 209 | $client = $this->getMock('Mailgun\Mailgun', ['BatchMessage']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 210 | // We expect that sendMessage() will fetch the message builder from the Mailgun client, and |
||
| 211 | // we use this point to inject our mock message builder |
||
| 212 | $client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 213 | ->method('BatchMessage') |
||
| 214 | ->with($this->equalTo($domain)) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 215 | ->will($this->returnValue($messageBuilder)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 216 | |||
| 217 | $mailer = $this->getMock( |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 218 | 'Kinglozzer\SilverStripeMailgunner\Mailer', |
||
| 219 | ['getMailgunClient', 'buildMessage', 'prepareAttachments', 'closeTempFileHandles'] |
||
| 220 | ); |
||
| 221 | // We inject our mock Mailgun client while asserting that sendMessage() does request it |
||
| 222 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 223 | ->method('getMailgunClient') |
||
| 224 | ->will($this->returnValue($client)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 225 | // We've got attachments, so we assert that sendMessage() passes them off to |
||
| 226 | // prepareAttachments() and specify a mock "prepared" return value |
||
| 227 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 228 | ->method('prepareAttachments') |
||
| 229 | ->with($this->equalTo($attachments)) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 230 | ->will($this->returnValue($preparedattachments)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 231 | // We expect that sendMessage() will pass everything off to the buildMessage() method |
||
| 232 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 233 | ->method('buildMessage') |
||
| 234 | ->with( |
||
| 235 | $this->equalTo($messageBuilder), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 236 | $this->equalTo($to), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 237 | $this->equalTo($from), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 238 | $this->equalTo($subject), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 239 | $this->equalTo($content), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 240 | $this->equalTo($plainContent), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 241 | $this->equalTo($preparedattachments), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 242 | $this->equalTo($headers) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 243 | ); |
||
| 244 | // Assert that the mailer attempts to close any remaining open file handles |
||
| 245 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 246 | ->method('closeTempFileHandles'); |
||
| 247 | |||
| 248 | // Special header to flag that we want to send a "batch message" |
||
| 249 | $headers['X-Mailgunner-Batch-Message'] = true; |
||
| 250 | |||
| 251 | // Let's go! |
||
| 252 | $this->invokeMethod( |
||
| 253 | $mailer, |
||
| 254 | 'sendMessage', |
||
| 255 | [$to, $from, $subject, $content, $plainContent, $attachments, $headers] |
||
| 256 | ); |
||
| 257 | } |
||
| 258 | |||
| 259 | public function testSendMessageExceptionClosesHandles() |
||
| 260 | { |
||
| 261 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 262 | |||
| 263 | $client = $this->getMock('Mailgun\Mailgun', ['sendMessage']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 264 | // Make our mock client trigger an exception |
||
| 265 | $client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 266 | ->method('sendMessage') |
||
| 267 | ->will($this->throwException(new \Exception)); |
||
|
0 ignored issues
–
show
The method
throwException() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 268 | |||
| 269 | $mailer = $this->getMock( |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 270 | 'Kinglozzer\SilverStripeMailgunner\Mailer', |
||
| 271 | ['getMailgunClient', 'closeTempFileHandles'] |
||
| 272 | ); |
||
| 273 | // Inject our mock Mailgun client |
||
| 274 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 275 | ->method('getMailgunClient') |
||
| 276 | ->will($this->returnValue($client)); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 277 | // Assert that the exception that the client throws triggers closing open file handles |
||
| 278 | $mailer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 279 | ->method('closeTempFileHandles'); |
||
| 280 | |||
| 281 | $response = $this->invokeMethod( |
||
| 282 | $mailer, |
||
| 283 | 'sendMessage', |
||
| 284 | [$to, $from, $subject, $content, $plainContent, $attachments, $headers] |
||
| 285 | ); |
||
| 286 | |||
| 287 | $this->assertFalse($response); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 288 | } |
||
| 289 | |||
| 290 | public function testBuildMessage() |
||
| 291 | { |
||
| 292 | list($to, $from, $subject, $content, $plainContent, $attachments, $headers) = $this->getMockEmail(); |
||
| 293 | // Mock "prepared" attachment |
||
| 294 | $attachments = [ |
||
| 295 | ['filePath' => '/foo/bar/baz', 'remoteName' => 'image.jpg'] |
||
| 296 | ]; |
||
| 297 | |||
| 298 | $messageBuilder = $this->getMock('Mailgun\Messages\MessageBuilder'); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 299 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 300 | ->method('addToRecipient') |
||
| 301 | ->with( |
||
| 302 | $this->equalTo('[email protected]'), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 303 | $this->equalTo(['full_name' => 'Foo Smith']) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 304 | ); |
||
| 305 | |||
| 306 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 307 | ->method('setFromAddress') |
||
| 308 | ->with( |
||
| 309 | $this->equalTo('[email protected]'), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 310 | $this->equalTo(['full_name' => 'Baz Smith']) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 311 | ); |
||
| 312 | |||
| 313 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 314 | ->method('setSubject') |
||
| 315 | ->with($this->equalTo($subject)); |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 316 | |||
| 317 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 318 | ->method('setHtmlBody') |
||
| 319 | ->with($this->equalTo($content)); |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 320 | |||
| 321 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 322 | ->method('setTextBody') |
||
| 323 | ->with($this->equalTo($plainContent)); |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 324 | |||
| 325 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 326 | ->method('addAttachment') |
||
| 327 | ->with( |
||
| 328 | $this->equalTo('/foo/bar/baz'), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 329 | $this->equalTo('image.jpg') |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 330 | ); |
||
| 331 | |||
| 332 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 333 | ->method('addCcRecipient') |
||
| 334 | ->with($this->equalTo($headers['Cc'])); |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 335 | |||
| 336 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 337 | ->method('addBccRecipient') |
||
| 338 | ->with($this->equalTo($headers['Bcc'])); |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 339 | |||
| 340 | $messageBuilder->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
once() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 341 | ->method('addCustomHeader') |
||
| 342 | ->with( |
||
| 343 | $this->equalTo('X-Custom-Header'), |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 344 | $this->equalTo('foo') |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 345 | ); |
||
| 346 | |||
| 347 | $this->invokeMethod( |
||
| 348 | new Mailer, |
||
| 349 | 'buildMessage', |
||
| 350 | [$messageBuilder, $to, $from, $subject, $content, $plainContent, $attachments, $headers] |
||
| 351 | ); |
||
| 352 | } |
||
| 353 | |||
| 354 | public function testParseAddresses() |
||
| 355 | { |
||
| 356 | $mailer = new Mailer; |
||
| 357 | |||
| 358 | $parsed = $this->invokeMethod($mailer, 'parseAddresses', ['[email protected]']); |
||
| 359 | $this->assertEquals(['[email protected]' => ''], $parsed); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 360 | |||
| 361 | $parsed = $this->invokeMethod($mailer, 'parseAddresses', ['Joe Bloggs <[email protected]>']); |
||
| 362 | $this->assertEquals(['[email protected]' => 'Joe Bloggs'], $parsed); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 363 | |||
| 364 | $parsed = $this->invokeMethod($mailer, 'parseAddresses', ['[email protected], [email protected]']); |
||
| 365 | $this->assertEquals(['[email protected]' => '', '[email protected]' => ''], $parsed); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 366 | |||
| 367 | // Test all the different formats |
||
| 368 | $raw = '"Joe Bloggs"<[email protected]>; John Smith <[email protected]>'; |
||
| 369 | $raw .= ', \'James\'<[email protected]>; [email protected],<[email protected]>'; |
||
| 370 | $expected = [ |
||
| 371 | '[email protected]' => 'Joe Bloggs', |
||
| 372 | '[email protected]' => 'John Smith', |
||
| 373 | '[email protected]' => 'James', |
||
| 374 | '[email protected]' => '', |
||
| 375 | '[email protected]' => '' |
||
| 376 | ]; |
||
| 377 | $actual = $this->invokeMethod($mailer, 'parseAddresses', [$raw]); |
||
| 378 | $this->assertEquals($expected, $actual); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 379 | } |
||
| 380 | |||
| 381 | public function testPrepareAttachments() |
||
| 382 | { |
||
| 383 | $attachments = [ |
||
| 384 | ['filename' => 'test1.jpg', 'contents' => 'abcdefg'], |
||
| 385 | ['filename' => 'test2.jpg', 'contents' => 'hijklmn'] |
||
| 386 | ]; |
||
| 387 | |||
| 388 | $expected = [ |
||
| 389 | ['filePath' => 'tmp/test1.jpg', 'remoteName' => 'test1.jpg'], |
||
| 390 | ['filePath' => 'tmp/test2.jpg', 'remoteName' => 'test2.jpg'] |
||
| 391 | ]; |
||
| 392 | |||
| 393 | $mailer = $this->getMock('Kinglozzer\SilverStripeMailgunner\Mailer', ['writeToTempFile']); |
||
|
0 ignored issues
–
show
The method
getMock() does not exist on Kinglozzer\SilverStripeMailgunner\Tests\MailerTest. Did you maybe mean getMockEmail()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 394 | $mailer->expects($this->at(0)) |
||
|
0 ignored issues
–
show
The method
at() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 395 | ->method('writeToTempFile') |
||
| 396 | ->with($this->equalTo('abcdefg')) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 397 | ->will($this->returnValue('tmp/test1.jpg')); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 398 | $mailer->expects($this->at(1)) |
||
|
0 ignored issues
–
show
The method
at() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 399 | ->method('writeToTempFile') |
||
| 400 | ->with($this->equalTo('hijklmn')) |
||
|
0 ignored issues
–
show
The method
equalTo() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 401 | ->will($this->returnValue('tmp/test2.jpg')); |
||
|
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 402 | |||
| 403 | $prepared = $this->invokeMethod($mailer, 'prepareAttachments', [$attachments]); |
||
| 404 | $this->assertEquals($expected, $prepared); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 405 | } |
||
| 406 | |||
| 407 | public function testWriteToTempFile() |
||
| 408 | { |
||
| 409 | $contents = 'test file contents'; |
||
| 410 | $mailer = new Mailer; |
||
| 411 | $tempFile = $this->invokeMethod($mailer, 'writeToTempFile', [$contents]); |
||
| 412 | |||
| 413 | $this->assertEquals($contents, file_get_contents($tempFile)); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 414 | |||
| 415 | // Assert that the stream and temp file path are stored |
||
| 416 | $reflection = new \ReflectionClass(get_class($mailer)); |
||
| 417 | $property = $reflection->getProperty('tempFileHandles'); |
||
| 418 | $property->setAccessible(true); |
||
| 419 | $fileHandles = $property->getValue($mailer); |
||
| 420 | |||
| 421 | $this->assertNotEmpty($fileHandles); |
||
|
0 ignored issues
–
show
The method
assertNotEmpty() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 422 | |||
| 423 | // Test the contents of the stream |
||
| 424 | $handle = $fileHandles[0]['handle']; |
||
| 425 | rewind($handle); |
||
| 426 | $this->assertEquals($contents, fread($handle, filesize($fileHandles[0]['path']))); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 427 | $this->assertEquals($tempFile, $fileHandles[0]['path']); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 428 | } |
||
| 429 | |||
| 430 | public function testCloseTempFileHandles() |
||
| 431 | { |
||
| 432 | $mailer = new Mailer; |
||
| 433 | $tempFile = tempnam(sys_get_temp_dir(), 'SS_MG_TESTS_TMP'); |
||
| 434 | $fileHandle = fopen($tempFile, 'w'); |
||
| 435 | fwrite($fileHandle, 'test data'); |
||
| 436 | $handleData = ['handle' => $fileHandle, 'path' => $tempFile]; |
||
| 437 | |||
| 438 | $reflection = new \ReflectionClass(get_class($mailer)); |
||
| 439 | $property = $reflection->getProperty('tempFileHandles'); |
||
| 440 | $property->setAccessible(true); |
||
| 441 | $fileHandles = $property->setValue($mailer, [$handleData]); |
||
|
0 ignored issues
–
show
$fileHandles is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 442 | |||
| 443 | $this->invokeMethod($mailer, 'closeTempFileHandles'); |
||
| 444 | |||
| 445 | $this->assertEmpty($property->getValue($mailer)); |
||
|
0 ignored issues
–
show
The method
assertEmpty() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 446 | $this->assertFalse(file_exists($tempFile)); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 447 | $this->assertEquals('Unknown', get_resource_type($fileHandle)); |
||
|
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<Kinglozzer\Silver...unner\Tests\MailerTest>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 448 | } |
||
| 449 | } |
||
| 450 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.