handler = new Pop3('testuser', 'testuser', 110); $this->handler->host = '127.0.0.1'; $this->handler->flags = '/pop3/notls'; try { if (!$this->handler->connectInbox()) { self::markTestSkipped(); } } catch (\Throwable $t) { self::markTestSkipped(); } } /** * {@inheritdoc} */ protected function tearDown() : void { $this->handler->closeInbox(); } public function testConnect() : void { $this->handler->closeInbox(); self::assertTrue($this->handler->connectInbox()); } public function testBoxes() : void { self::assertTrue(\in_array('INBOX', $this->handler->getBoxes())); } /* Not working with pop3 public function testBoxesInputOutputDelte() : void { $startCount = \count($this->handler->getBoxes()); self::assertTrue($this->handler->createBox('TestBox')); self::assertTrue(\in_array('TestBox', $this->handler->getBoxes())); self::assertCount($startCount + 1, $this->handler->getBoxes()); self::assertTrue($this->handler->renameBox('TestBox', 'NewTestBox')); self::assertTrue(\in_array('NewTestBox', $this->handler->getBoxes())); self::assertCount($startCount + 1, $this->handler->getBoxes()); self::assertTrue($this->handler->deleteBox('NewTestBox')); self::assertCount($startCount, $this->handler->getBoxes()); } */ public function testWithActualMail() : void { \mail('testuser@localhost', 'Test Subject', 'This is my test message!'); self::assertGreaterThan(0, $mailCount = $this->handler->countMail('INBOX')); //self::assertGreaterThan(0, $recentCount = $this->handler->countRecent('INBOX')); self::assertGreaterThan(0, \count($this->handler->getHeaders('INBOX'))); } public function testMailboxInfo() : void { $info = $this->handler->getMailboxInfo('INBOX'); self::assertGreaterThan(0, $info->messages); self::assertGreaterThan(0, $info->recent); self::assertGreaterThan(0, $info->unseen); } public function testCountMail() : void { self::assertGreaterThan(0, $this->handler->countMail('INBOX')); } public function testCountRecent() : void { $this->handler->createBox('INBOX'); self::assertGreaterThan(0, $this->handler->countRecent('INBOX')); $this->handler->deleteBox('INBOX'); } }