/** * 設定ファイルに存在する全てのインスタンスを返す * * @return BcAgent[] */ public function testFindAll() { $result = $this->agent->findAll(); $mobile = new BcAgent('mobile', array('alias' => 'm', 'prefix' => 'mobile', 'autoRedirect' => true, 'autoLink' => true, 'agents' => array('Googlebot-Mobile', 'Y!J-SRD', 'Y!J-MBS', 'DoCoMo', 'SoftBank', 'Vodafone', 'J-PHONE', 'UP.Browser'), 'sessionId' => true)); $expect = array($mobile, $this->agent); $this->assertEquals($expect, $result, '設定ファイルに存在するすべてのインスタンスを正しく返すことができません'); }
/** * リクエスト検出器の設定を取得 * * @return array */ public function getDetectorConfigs() { $configs = array(); $configs['admin'] = array('callback' => array($this, 'isAdmin')); $configs['asset'] = array('callback' => array($this, 'isAsset')); $configs['install'] = array('callback' => array($this, 'isInstall')); $configs['maintenance'] = array('callback' => array($this, 'isMaintenance')); $configs['update'] = array('callback' => array($this, 'isUpdate')); $configs['page'] = array('callback' => array($this, 'isPage')); $agents = BcAgent::findAll(); foreach ($agents as $agent) { $configs[$agent->name] = array('env' => 'HTTP_USER_AGENT', 'pattern' => $agent->getUserAgentRegex()); $configs["{$agent->name}url"] = array('callback' => array($agent, 'urlMatches')); } return $configs; }