コード例 #1
0
 public function testIsAPICall()
 {
     $builders = $this->buildData();
     $controller = new TestAuthAPIController(true);
     // API call (JSON)
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = Session::getAPISecretFromPassword('XXX');
     $results = $controller->go();
     $this->assertPattern('/{"result":"success"}/', $results);
     $this->assertFalse(strpos($results, '<html'));
     unset($_GET['as']);
     unset($_GET['un']);
     // HTML
     $this->simulateLogin('*****@*****.**');
     $results = $controller->go();
     $this->assertFalse(strpos($results, '{"result":"success"}'));
     $this->assertPattern('/<html/', $results);
 }
コード例 #2
0
 public function testIsAPICall()
 {
     $builders = $this->buildData();
     $controller = new TestAuthAPIController(true);
     // API call (JSON)
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
     $results = $controller->go();
     $this->assertPattern('/{"result":"success"}/', $results);
     $this->assertFalse(strpos($results, '<html'));
     unset($_GET['as']);
     unset($_GET['un']);
     // HTML
     $this->simulateLogin('*****@*****.**');
     $results = $controller->go();
     $this->assertFalse(strpos($results, '{"result":"success"}'));
     $this->assertPattern('/<html/', $results);
 }