OSDN Git Service

Добавлена возможность изменения количества записей, выводимых на странице предметов...
[invent/invent.git] / vendor / swiftmailer / swiftmailer / tests / unit / Swift / Plugins / Reporters / HitReporterTest.php
1 <?php
2
3 class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit\Framework\TestCase
4 {
5     private $hitReporter;
6     private $message;
7
8     protected function setUp()
9     {
10         $this->hitReporter = new Swift_Plugins_Reporters_HitReporter();
11         $this->message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
12     }
13
14     public function testReportingFail()
15     {
16         $this->hitReporter->notify($this->message, 'foo@bar.tld',
17             Swift_Plugins_Reporter::RESULT_FAIL
18             );
19         $this->assertEquals(['foo@bar.tld'],
20             $this->hitReporter->getFailedRecipients()
21             );
22     }
23
24     public function testMultipleReports()
25     {
26         $this->hitReporter->notify($this->message, 'foo@bar.tld',
27             Swift_Plugins_Reporter::RESULT_FAIL
28             );
29         $this->hitReporter->notify($this->message, 'zip@button',
30             Swift_Plugins_Reporter::RESULT_FAIL
31             );
32         $this->assertEquals(['foo@bar.tld', 'zip@button'],
33             $this->hitReporter->getFailedRecipients()
34             );
35     }
36
37     public function testReportingPassIsIgnored()
38     {
39         $this->hitReporter->notify($this->message, 'foo@bar.tld',
40             Swift_Plugins_Reporter::RESULT_FAIL
41             );
42         $this->hitReporter->notify($this->message, 'zip@button',
43             Swift_Plugins_Reporter::RESULT_PASS
44             );
45         $this->assertEquals(['foo@bar.tld'],
46             $this->hitReporter->getFailedRecipients()
47             );
48     }
49
50     public function testBufferCanBeCleared()
51     {
52         $this->hitReporter->notify($this->message, 'foo@bar.tld',
53             Swift_Plugins_Reporter::RESULT_FAIL
54             );
55         $this->hitReporter->notify($this->message, 'zip@button',
56             Swift_Plugins_Reporter::RESULT_FAIL
57             );
58         $this->assertEquals(['foo@bar.tld', 'zip@button'],
59             $this->hitReporter->getFailedRecipients()
60             );
61         $this->hitReporter->clear();
62         $this->assertEquals([], $this->hitReporter->getFailedRecipients());
63     }
64 }