MaildirWritableTest.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Mail
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Zend_Mail_Storage_Folder_Maildir
  24. */
  25. require_once 'Zend/Mail/Storage/Writable/Maildir.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Mail
  29. * @subpackage UnitTests
  30. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. * @group Zend_Mail
  33. */
  34. class Zend_Mail_MaildirWritableTest extends PHPUnit_Framework_TestCase
  35. {
  36. protected $_params;
  37. protected $_originalDir;
  38. protected $_tmpdir;
  39. protected $_subdirs = array('.', '.subfolder', '.subfolder.test');
  40. public function setUp()
  41. {
  42. $this->_originalDir = dirname(__FILE__) . '/_files/test.maildir/';
  43. if (!is_dir($this->_originalDir . '/cur/')) {
  44. $this->markTestSkipped('You have to unpack maildir.tar in Zend/Mail/_files/test.maildir/ '
  45. . 'directory before enabling the maildir tests');
  46. return;
  47. }
  48. if ($this->_tmpdir == null) {
  49. if (TESTS_ZEND_MAIL_TEMPDIR != null) {
  50. $this->_tmpdir = TESTS_ZEND_MAIL_TEMPDIR;
  51. } else {
  52. $this->_tmpdir = dirname(__FILE__) . '/_files/test.tmp/';
  53. }
  54. if (!file_exists($this->_tmpdir)) {
  55. mkdir($this->_tmpdir);
  56. }
  57. $count = 0;
  58. $dh = opendir($this->_tmpdir);
  59. while (readdir($dh) !== false) {
  60. ++$count;
  61. }
  62. closedir($dh);
  63. if ($count != 2) {
  64. $this->markTestSkipped('Are you sure your tmp dir is a valid empty dir?');
  65. return;
  66. }
  67. }
  68. $this->_params = array();
  69. $this->_params['dirname'] = $this->_tmpdir;
  70. foreach ($this->_subdirs as $dir) {
  71. if ($dir != '.') {
  72. mkdir($this->_tmpdir . $dir);
  73. }
  74. foreach (array('cur', 'new') as $subdir) {
  75. if (!file_exists($this->_originalDir . $dir . '/' . $subdir)) {
  76. continue;
  77. }
  78. mkdir($this->_tmpdir . $dir . '/' . $subdir);
  79. $dh = opendir($this->_originalDir . $dir . '/' . $subdir);
  80. while (($entry = readdir($dh)) !== false) {
  81. $entry = $dir . '/' . $subdir . '/' . $entry;
  82. if (!is_file($this->_originalDir . $entry)) {
  83. continue;
  84. }
  85. copy($this->_originalDir . $entry, $this->_tmpdir . $entry);
  86. }
  87. closedir($dh);
  88. }
  89. copy($this->_originalDir . 'maildirsize', $this->_tmpdir . 'maildirsize');
  90. }
  91. }
  92. public function tearDown()
  93. {
  94. foreach (array_reverse($this->_subdirs) as $dir) {
  95. if (!file_exists($this->_tmpdir . $dir)) {
  96. continue;
  97. }
  98. foreach (array('cur', 'new', 'tmp') as $subdir) {
  99. if (!file_exists($this->_tmpdir . $dir . '/' . $subdir)) {
  100. continue;
  101. }
  102. $dh = opendir($this->_tmpdir . $dir . '/' . $subdir);
  103. while (($entry = readdir($dh)) !== false) {
  104. $entry = $this->_tmpdir . $dir . '/' . $subdir . '/' . $entry;
  105. if (!is_file($entry)) {
  106. continue;
  107. }
  108. unlink($entry);
  109. }
  110. closedir($dh);
  111. rmdir($this->_tmpdir . $dir . '/' . $subdir);
  112. }
  113. if ($dir != '.') {
  114. rmdir($this->_tmpdir . $dir);
  115. }
  116. }
  117. @unlink($this->_tmpdir . 'maildirsize');
  118. }
  119. public function testCreateFolder()
  120. {
  121. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  122. $mail->createFolder('subfolder.test1');
  123. $mail->createFolder('test2', 'INBOX.subfolder');
  124. $mail->createFolder('test3', $mail->getFolders()->subfolder);
  125. $mail->createFolder('foo.bar');
  126. try {
  127. $mail->selectFolder($mail->getFolders()->subfolder->test1);
  128. $mail->selectFolder($mail->getFolders()->subfolder->test2);
  129. $mail->selectFolder($mail->getFolders()->subfolder->test3);
  130. $mail->selectFolder($mail->getFolders()->foo->bar);
  131. } catch (Exception $e) {
  132. $this->fail('could not get new folders');
  133. }
  134. // to tear down
  135. $this->_subdirs[] = '.subfolder.test1';
  136. $this->_subdirs[] = '.subfolder.test2';
  137. $this->_subdirs[] = '.subfolder.test3';
  138. $this->_subdirs[] = '.foo';
  139. $this->_subdirs[] = '.foo.bar';
  140. }
  141. public function testCreateFolderEmtpyPart()
  142. {
  143. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  144. try {
  145. $mail->createFolder('foo..bar');
  146. } catch (Exception $e) {
  147. return; //ok
  148. }
  149. $this->fail('no exception while creating folder with empty part name');
  150. }
  151. public function testCreateFolderSlash()
  152. {
  153. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  154. try {
  155. $mail->createFolder('foo/bar');
  156. } catch (Exception $e) {
  157. return; //ok
  158. }
  159. $this->fail('no exception while creating folder with slash');
  160. }
  161. public function testCreateFolderDirectorySeparator()
  162. {
  163. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  164. try {
  165. $mail->createFolder('foo' . DIRECTORY_SEPARATOR . 'bar');
  166. } catch (Exception $e) {
  167. return; //ok
  168. }
  169. $this->fail('no exception while creating folder with DIRECTORY_SEPARATOR');
  170. }
  171. public function testCreateFolderExistingDir()
  172. {
  173. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  174. unset($mail->getFolders()->subfolder->test);
  175. try {
  176. $mail->createFolder('subfolder.test');
  177. } catch (Exception $e) {
  178. return; // ok
  179. }
  180. $this->fail('should not be able to create existing folder');
  181. }
  182. public function testCreateExistingFolder()
  183. {
  184. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  185. try {
  186. $mail->createFolder('subfolder.test');
  187. } catch (Exception $e) {
  188. return; // ok
  189. }
  190. $this->fail('should not be able to create existing folder');
  191. }
  192. public function testRemoveFolderName()
  193. {
  194. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  195. $mail->removeFolder('INBOX.subfolder.test');
  196. try {
  197. $mail->selectFolder($mail->getFolders()->subfolder->test);
  198. } catch (Exception $e) {
  199. return; // ok
  200. }
  201. $this->fail('folder still exists');
  202. }
  203. public function testRemoveFolderInstance()
  204. {
  205. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  206. $mail->removeFolder($mail->getFolders()->subfolder->test);
  207. try {
  208. $mail->selectFolder($mail->getFolders()->subfolder->test);
  209. } catch (Exception $e) {
  210. return; // ok
  211. }
  212. $this->fail('folder still exists');
  213. }
  214. public function testRemoveFolderWithChildren()
  215. {
  216. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  217. try {
  218. $mail->removeFolder($mail->getFolders()->subfolder);
  219. } catch (Exception $e) {
  220. return; // ok
  221. }
  222. $this->fail('should not be able to remove a folder with children');
  223. }
  224. public function testRemoveSelectedFolder()
  225. {
  226. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  227. $mail->selectFolder('subfolder.test');
  228. try {
  229. $mail->removeFolder('subfolder.test');
  230. } catch (Exception $e) {
  231. return; // ok
  232. }
  233. $this->fail('no error while removing selected folder');
  234. }
  235. public function testRemoveInvalidFolder()
  236. {
  237. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  238. try {
  239. $mail->removeFolder('thisFolderDoestNotExist');
  240. } catch (Exception $e) {
  241. return; // ok
  242. }
  243. $this->fail('no error while removing invalid folder');
  244. }
  245. public function testRenameFolder()
  246. {
  247. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  248. try {
  249. $mail->renameFolder('INBOX.subfolder', 'INBOX.foo');
  250. $mail->renameFolder($mail->getFolders()->foo, 'subfolder');
  251. } catch (Exception $e) {
  252. $this->fail('renaming failed');
  253. }
  254. try {
  255. $mail->renameFolder('INBOX', 'foo');
  256. } catch (Exception $e) {
  257. return; // ok
  258. }
  259. $this->fail('no error while renaming INBOX');
  260. }
  261. public function testRenameSelectedFolder()
  262. {
  263. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  264. $mail->selectFolder('subfolder.test');
  265. try {
  266. $mail->renameFolder('subfolder.test', 'foo');
  267. } catch (Exception $e) {
  268. return; // ok
  269. }
  270. $this->fail('no error while renaming selected folder');
  271. }
  272. public function testRenameToChild()
  273. {
  274. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  275. try {
  276. $mail->renameFolder('subfolder.test', 'subfolder.test.foo');
  277. } catch (Exception $e) {
  278. return; // ok
  279. }
  280. $this->fail('no error while renaming folder to child of old');
  281. }
  282. public function testAppend()
  283. {
  284. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  285. $count = $mail->countMessages();
  286. $message = '';
  287. $message .= "From: me@example.org\r\n";
  288. $message .= "To: you@example.org\r\n";
  289. $message .= "Subject: append test\r\n";
  290. $message .= "\r\n";
  291. $message .= "This is a test\r\n";
  292. $mail->appendMessage($message);
  293. $this->assertEquals($count + 1, $mail->countMessages());
  294. $this->assertEquals($mail->getMessage($count + 1)->subject, 'append test');
  295. }
  296. public function testCopy()
  297. {
  298. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  299. $mail->selectFolder('subfolder.test');
  300. $count = $mail->countMessages();
  301. $mail->selectFolder('INBOX');
  302. $message = $mail->getMessage(1);
  303. $mail->copyMessage(1, 'subfolder.test');
  304. $mail->selectFolder('subfolder.test');
  305. $this->assertEquals($count + 1, $mail->countMessages());
  306. $this->assertEquals($mail->getMessage($count + 1)->subject, $message->subject);
  307. $this->assertEquals($mail->getMessage($count + 1)->from, $message->from);
  308. $this->assertEquals($mail->getMessage($count + 1)->to, $message->to);
  309. try {
  310. $mail->copyMessage(1, 'justARandomFolder');
  311. } catch (Exception $e) {
  312. return; // ok
  313. }
  314. $this->fail('no error while copying to wrong folder');
  315. }
  316. public function testSetFlags()
  317. {
  318. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  319. $mail->setFlags(1, array(Zend_Mail_Storage::FLAG_SEEN));
  320. $message = $mail->getMessage(1);
  321. $this->assertTrue($message->hasFlag(Zend_Mail_Storage::FLAG_SEEN));
  322. $this->assertFalse($message->hasFlag(Zend_Mail_Storage::FLAG_FLAGGED));
  323. $mail->setFlags(1, array(Zend_Mail_Storage::FLAG_SEEN, Zend_Mail_Storage::FLAG_FLAGGED));
  324. $message = $mail->getMessage(1);
  325. $this->assertTrue($message->hasFlag(Zend_Mail_Storage::FLAG_SEEN));
  326. $this->assertTrue($message->hasFlag(Zend_Mail_Storage::FLAG_FLAGGED));
  327. $mail->setFlags(1, array(Zend_Mail_Storage::FLAG_FLAGGED));
  328. $message = $mail->getMessage(1);
  329. $this->assertFalse($message->hasFlag(Zend_Mail_Storage::FLAG_SEEN));
  330. $this->assertTrue($message->hasFlag(Zend_Mail_Storage::FLAG_FLAGGED));
  331. try {
  332. $mail->setFlags(1, array(Zend_Mail_Storage::FLAG_RECENT));
  333. } catch (Exception $e) {
  334. return; // ok
  335. }
  336. $this->fail('should not be able to set recent flag');
  337. }
  338. public function testSetFlagsRemovedFile()
  339. {
  340. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  341. unlink($this->_params['dirname'] . 'cur/1000000000.P1.example.org:2,S');
  342. try {
  343. $mail->setFlags(1, array(Zend_Mail_Storage::FLAG_FLAGGED));
  344. } catch (Exception $e) {
  345. return; // ok
  346. }
  347. $this->fail('should not be able to set flags with removed file');
  348. }
  349. public function testRemove()
  350. {
  351. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  352. $count = $mail->countMessages();
  353. $mail->removeMessage(1);
  354. $this->assertEquals($mail->countMessages(), --$count);
  355. unset($mail[2]);
  356. $this->assertEquals($mail->countMessages(), --$count);
  357. }
  358. public function testRemoveRemovedFile()
  359. {
  360. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  361. unlink($this->_params['dirname'] . 'cur/1000000000.P1.example.org:2,S');
  362. try {
  363. $mail->removeMessage(1);
  364. } catch (Exception $e) {
  365. return; // ok
  366. }
  367. $this->fail('should not be able to remove message which is already removed in fs');
  368. }
  369. public function testCheckQuota()
  370. {
  371. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  372. $this->assertFalse($mail->checkQuota());
  373. }
  374. public function testCheckQuotaDetailed()
  375. {
  376. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  377. $quotaResult = array(
  378. 'size' => 2596,
  379. 'count' => 6,
  380. 'quota' => array(
  381. 'count' => 10,
  382. 'L' => 1,
  383. 'size' => 3000
  384. ),
  385. 'over_quota' => false
  386. );
  387. $this->assertEquals($mail->checkQuota(true), $quotaResult);
  388. }
  389. public function testSetQuota()
  390. {
  391. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  392. $this->assertNull($mail->getQuota());
  393. $mail->setQuota(true);
  394. $this->assertTrue($mail->getQuota());
  395. $mail->setQuota(false);
  396. $this->assertFalse($mail->getQuota());
  397. $mail->setQuota(array('size' => 100, 'count' => 2, 'X' => 0));
  398. $this->assertEquals($mail->getQuota(), array('size' => 100, 'count' => 2, 'X' => 0));
  399. $this->assertEquals($mail->getQuota(true), array('size' => 3000, 'L' => 1, 'count' => 10));
  400. $quotaResult = array(
  401. 'size' => 2596,
  402. 'count' => 6,
  403. 'quota' => array(
  404. 'size' => 100,
  405. 'count' => 2,
  406. 'X' => 0
  407. ),
  408. 'over_quota' => true
  409. );
  410. $this->assertEquals($mail->checkQuota(true, true), $quotaResult);
  411. $this->assertEquals($mail->getQuota(true), array('size' => 100, 'count' => 2, 'X' => 0));
  412. }
  413. public function testMissingMaildirsize()
  414. {
  415. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  416. $this->assertEquals($mail->getQuota(true), array('size' => 3000, 'L' => 1, 'count' => 10));
  417. unlink($this->_tmpdir . 'maildirsize');
  418. $this->assertNull($mail->getQuota());
  419. try {
  420. $mail->getQuota(true);
  421. } catch(Zend_Mail_Exception $e) {
  422. // ok
  423. return;
  424. }
  425. $this->fail('get quota from file should fail if file is missing');
  426. }
  427. public function testMissingMaildirsizeWithFixedQuota()
  428. {
  429. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  430. unlink($this->_tmpdir . 'maildirsize');
  431. $mail->setQuota(array('size' => 100, 'count' => 2, 'X' => 0));
  432. $quotaResult = array(
  433. 'size' => 2596,
  434. 'count' => 6,
  435. 'quota' => array(
  436. 'size' => 100,
  437. 'count' => 2,
  438. 'X' => 0
  439. ),
  440. 'over_quota' => true
  441. );
  442. $this->assertEquals($mail->checkQuota(true), $quotaResult);
  443. $this->assertEquals($mail->getQuota(true), $quotaResult['quota']);
  444. }
  445. public function testAppendMessage()
  446. {
  447. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  448. $mail->setQuota(array('size' => 3000, 'count' => 6, 'X' => 0));
  449. $this->assertFalse($mail->checkQuota(false, true));
  450. $mail->appendMessage("Subject: test\r\n\r\n");
  451. $quotaResult = array(
  452. 'size' => 2613,
  453. 'count' => 7,
  454. 'quota' => array(
  455. 'size' => 3000,
  456. 'count' => 6,
  457. 'X' => 0
  458. ),
  459. 'over_quota' => true
  460. );
  461. $this->assertEquals($mail->checkQuota(true), $quotaResult);
  462. $mail->setQuota(false);
  463. $this->assertTrue($mail->checkQuota());
  464. try {
  465. $mail->appendMessage("Subject: test\r\n\r\n");
  466. } catch(Zend_Mail_Exception $e) {
  467. $this->fail('appending should not fail if quota check is not active');
  468. }
  469. $mail->setQuota(true);
  470. $this->assertTrue($mail->checkQuota());
  471. try {
  472. $mail->appendMessage("Subject: test\r\n\r\n");
  473. } catch(Zend_Mail_Exception $e) {
  474. // ok
  475. return;
  476. }
  477. $this->fail('appending after being over quota should fail');
  478. }
  479. public function testRemoveMessage()
  480. {
  481. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  482. $mail->setQuota(array('size' => 3000, 'count' => 5, 'X' => 0));
  483. $this->assertTrue($mail->checkQuota(false, true));
  484. $mail->removeMessage(1);
  485. $this->assertFalse($mail->checkQuota());
  486. }
  487. public function testCopyMessage()
  488. {
  489. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  490. $mail->setQuota(array('size' => 3000, 'count' => 6, 'X' => 0));
  491. $this->assertFalse($mail->checkQuota(false, true));
  492. $mail->copyMessage(1, 'subfolder');
  493. $quotaResult = array(
  494. 'size' => 2993,
  495. 'count' => 7,
  496. 'quota' => array(
  497. 'size' => 3000,
  498. 'count' => 6,
  499. 'X' => 0
  500. ),
  501. 'over_quota' => true
  502. );
  503. $this->assertEquals($mail->checkQuota(true), $quotaResult);
  504. }
  505. public function testAppendStream()
  506. {
  507. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  508. $fh = fopen('php://memory', 'rw');
  509. fputs($fh, "Subject: test\r\n\r\n");
  510. fseek($fh, 0);
  511. $mail->appendMessage($fh);
  512. fclose($fh);
  513. $this->assertEquals($mail->getMessage($mail->countMessages())->subject, 'test');
  514. }
  515. public function testMove()
  516. {
  517. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  518. $target = $mail->getFolders()->subfolder->test;
  519. $mail->selectFolder($target);
  520. $toCount = $mail->countMessages();
  521. $mail->selectFolder('INBOX');
  522. $fromCount = $mail->countMessages();
  523. $mail->moveMessage(1, $target);
  524. $this->assertEquals($fromCount - 1, $mail->countMessages());
  525. $mail->selectFolder($target);
  526. $this->assertEquals($toCount + 1, $mail->countMessages());
  527. }
  528. public function testInitExisting()
  529. {
  530. // this should be a noop
  531. Zend_Mail_Storage_Writable_Maildir::initMaildir($this->_params['dirname']);
  532. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  533. $this->assertEquals($mail->countMessages(), 5);
  534. }
  535. public function testInit()
  536. {
  537. $this->tearDown();
  538. // should fail now
  539. $e = null;
  540. try {
  541. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  542. } catch (Exception $e) {
  543. }
  544. if ($e === null) {
  545. $this->fail('empty maildir should not be accepted');
  546. }
  547. Zend_Mail_Storage_Writable_Maildir::initMaildir($this->_params['dirname']);
  548. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  549. $this->assertEquals($mail->countMessages(), 0);
  550. }
  551. public function testCreate()
  552. {
  553. $this->tearDown();
  554. // should fail now
  555. $e = null;
  556. try {
  557. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  558. } catch (Exception $e) {
  559. }
  560. if ($e === null) {
  561. $this->fail('empty maildir should not be accepted');
  562. }
  563. $this->_params['create'] = true;
  564. $mail = new Zend_Mail_Storage_Writable_Maildir($this->_params);
  565. $this->assertEquals($mail->countMessages(), 0);
  566. }
  567. }