object()->system->user; foreach ($users as $user) { if ((string)$user->name === 'root' && password_verify($password, (string)$user->password)) { break; } } if (!isset($user) || (string)$user->name !== 'root' || !password_verify($password, (string)$user->password)) { throw new RuntimeException('The disposable WebGUI password was not saved.'); } exec('/usr/local/sbin/configctl webgui restart', $output, $status); if ($status !== 0) { throw new RuntimeException('The WebGUI did not restart.'); } $aliases = new Alias(); foreach ($aliases->aliases->alias->iterateItems() as $alias) { if ((string)$alias->name === 'UI_TEST_NETWORK') { return; } } $alias = $aliases->aliases->alias->add(); $alias->setNodes([ 'enabled' => '1', 'name' => 'UI_TEST_NETWORK', 'type' => 'network', 'proto' => 'IPv4', 'content' => '192.0.2.0/24', ]); $aliases->serializeToConfig(); Config::getInstance()->save(['description' => 'Add synthetic UI test alias']);