public function testSelect() { $path1 = './test_data/test_mailbox_' . date('Ymd_His') . '_' . uniqid('', true); $log = new Logger('test_application'); #$log->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG)); $server = new Server('', 0); $server->setLog($log); $server->init(); $storage1 = new DirectoryStorage(); $storage1->setPath($path1); $server->addStorage($storage1); $server->addFolder('test_dir1'); $server->addFolder('test_dir2'); $client1 = new Client(); $client1->setServer($server); $client1->setId(1); $client2 = new Client(); $client2->setServer($server); $client2->setId(2); $client1->select('test_dir1'); $this->assertEquals('test_dir1', $client1->getSelectedFolder()); $this->assertEquals(null, $client2->getSelectedFolder()); $client1->select('test_dir2'); $this->assertEquals('test_dir2', $client1->getSelectedFolder()); $this->assertEquals(null, $client2->getSelectedFolder()); $client2->select('test_dir1'); $this->assertEquals('test_dir2', $client1->getSelectedFolder()); $this->assertEquals('test_dir1', $client2->getSelectedFolder()); }
public function clientRemove(Client $client) { $this->log->debug('client remove: ' . $client->getId()); $client->shutdown(); $clientsId = $client->getId(); unset($this->clients[$clientsId]); }