/** * 判断用户是否是管理员 * @param $userName */ public function isAdmin($userName) { $adminConfig = \Util_Config::getConfig('admin'); if ($userName == $adminConfig->administrator->name) { return true; } return false; }
public function testGetConfig() { $config = Util_Config::getConfig('admin'); $this->assertEquals(['administrator' => ['name' => 'admin', 'pwd' => 'admin']], $config->toArray()); $this->assertEquals('admin', $config->administrator->name); }