@@ 30-49 (lines=20) @@ | ||
27 | $this->assertContains("Mailgun accepted the request to send/forward the email and the message has been placed in queue.", $display); |
|
28 | } |
|
29 | ||
30 | public function testDeleteOldEntries_WithoutParams() |
|
31 | { |
|
32 | $application = new Application(); |
|
33 | $application->add(new DeleteOldEntriesCommand($this->mailgunServiceMock)); |
|
34 | $command = $this->getDeleteOldEntriesCommand($application); |
|
35 | ||
36 | self::$days = 60; |
|
37 | self::$count = 14; |
|
38 | self::$type = null; |
|
39 | $this->mailgunServiceMock->expects($this->once())->method("removeEvents")->will($this->returnCallback(array($this, "removeEventsCallback"))); |
|
40 | ||
41 | $tester = new CommandTester($command); |
|
42 | ||
43 | $tester->execute(array('')); |
|
44 | $display = $tester->getDisplay(); |
|
45 | $this->assertContains("deleting entries of any type.", $display); |
|
46 | $this->assertContains("using default age-limit of '60 days ago'.", $display); |
|
47 | $this->assertContains("All MailgunEvents (& their CustomVariables & Attachments) older than", $display); |
|
48 | $this->assertContains("of any type have been deleted (14).", $display); |
|
49 | } |
|
50 | ||
51 | public static $days; |
|
52 | public static $count; |
|
@@ 73-91 (lines=19) @@ | ||
70 | return $application->find('mailgun:delete-events'); |
|
71 | } |
|
72 | ||
73 | public function testDeleteOldEntries_WithDate() |
|
74 | { |
|
75 | $application = new Application(); |
|
76 | $application->add(new DeleteOldEntriesCommand($this->mailgunServiceMock)); |
|
77 | $command = $this->getDeleteOldEntriesCommand($application); |
|
78 | ||
79 | self::$days = 21; |
|
80 | self::$count = 11; |
|
81 | self::$type = null; |
|
82 | $this->mailgunServiceMock->expects($this->once())->method("removeEvents")->will($this->returnCallback(array($this, "removeEventsCallback"))); |
|
83 | ||
84 | $tester = new CommandTester($command); |
|
85 | ||
86 | $tester->execute(array("date" => "21 days ago")); |
|
87 | $display = $tester->getDisplay(); |
|
88 | $this->assertContains("deleting entries of any type.", $display); |
|
89 | $this->assertContains("All MailgunEvents (& their CustomVariables & Attachments) older than", $display); |
|
90 | $this->assertContains("of any type have been deleted (11).", $display); |
|
91 | } |
|
92 | ||
93 | public function testDeleteOldEntries_WithDateAndType() |
|
94 | { |