Example #1
0
 public function testShutdownStorages()
 {
     $path1 = './test_data/test_mailbox_' . date('Ymd_His') . '_' . uniqid('', true);
     $path2 = './test_data/test_mailbox_' . date('Ymd_His') . '_' . uniqid('', true);
     $path3 = './test_data/test_mailbox_' . date('Ymd_His') . '_' . uniqid('', true);
     $server = new Server('', 0);
     $server->setLog(new Logger('test_application'));
     $server->init();
     $storage1 = new DirectoryStorage();
     $storage1->setPath($path1);
     $server->addStorage($storage1);
     $storage2db = new MsgDb();
     $storage2 = new TestStorage();
     $storage2->setPath($path2);
     $storage2->setType('temp');
     $storage2->setDb($storage2db);
     $storage2->setDbPath($path2 . '/msgdb.yml');
     $server->addStorage($storage2);
     $storage3 = new TestStorage();
     $storage3->setPath($path3);
     $server->addStorage($storage3);
     $this->assertEquals('normal', $storage1->getType());
     $this->assertEquals('temp', $storage2->getType());
     $this->assertEquals('normal', $storage3->getType());
     $this->assertTrue($server->getDefaultStorage() instanceof DirectoryStorage);
     $server->addFolder('test_dir1');
     #$server->shutdownStorages();
     $server->shutdown();
     $this->assertTrue(file_exists($path1));
     $this->assertFalse(file_exists($path2));
     $this->assertTrue(file_exists($path3));
     $filesystem = new Filesystem();
     $filesystem->remove($storage1->getPath());
     $filesystem->remove($storage2->getPath());
     $filesystem->remove($storage3->getPath());
 }
Example #2
0
 public function testGetDirectorySeperator()
 {
     $storage = new TestStorage();
     $this->assertEquals('_', $storage->getDirectorySeperator());
 }