run() public method

public run ( )
 /**
  *
  */
 public function testRunWithoutObjTypeIs404()
 {
     $request = Request::createFromEnvironment(Environment::mock());
     $response = new Response();
     $res = $this->obj->run($request, $response);
     $this->assertEquals(404, $res->getStatusCode());
     $res = $this->obj->results();
     $this->assertFalse($res['success']);
 }
 public function testRunWithInvalidRecaptchaReturns404()
 {
     $request = Request::createFromEnvironment(Environment::mock(['QUERY_STRING' => 'username=foobar&g-recaptcha-response=foobar']));
     $response = new Response();
     $res = $this->obj->run($request, $response);
     $this->assertEquals(404, $res->getStatusCode());
     $res = $this->obj->results();
     $this->assertFalse($res['success']);
 }
 /**
  *
  */
 public function testRun()
 {
     $this->createUser('foo');
     $request = Request::createFromEnvironment(Environment::mock(['QUERY_STRING' => 'obj_type=charcoal/admin/user']));
     $response = new Response();
     $res = $this->obj->run($request, $response);
     $this->assertEquals(200, $res->getStatusCode());
     $res = $this->obj->results();
     $this->assertTrue($res['success']);
 }
 /**
  *
  */
 public function testRun()
 {
     $container = $this->container();
     $userProto = $container['model/factory']->create(User::class);
     $userProto->source()->createTable();
     $request = Request::createFromEnvironment(Environment::mock(['QUERY_STRING' => 'obj_type=charcoal/admin/user&obj_orders[]=foo&obj_orders[]=bar']));
     $response = new Response();
     $res = $this->obj->run($request, $response);
     $this->assertEquals(200, $res->getStatusCode());
     $res = $this->obj->results();
     $this->assertTrue($res['success']);
 }
 /**
  *
  */
 public function testRunWithObjectDelete()
 {
     $objId = 'foo';
     $user = $this->createUser($objId);
     $this->assertTrue($this->userExists($objId));
     $request = Request::createFromEnvironment(Environment::mock(['QUERY_STRING' => 'obj_type=charcoal/admin/user&obj_id=' . $objId]));
     $response = new Response();
     $res = $this->obj->run($request, $response);
     $this->assertEquals(200, $res->getStatusCode());
     $res = $this->obj->results();
     $this->assertTrue($res['success']);
     $this->assertFalse($this->userExists($objId));
 }
Beispiel #6
0
<?php

require_once 'login.class.php';
$action = new LoginAction();
$action->run();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>湖南农业大学 后台管理</title>
</head>
<script type="text/javascript">
function loadb(){	 
	    document.forms[0].elements['oldpwd'].focus();
        return true;
}
function checkspace(checkstr)
{
  var str = '';
  for(i = 0; i < checkstr.length; i++)
  {
    str = str + ' ';
  }
  return (str == checkstr);
} 
function checkdata() {
	var f1 = document.form1;	
	
	if(f1.oldpwd.value=="" || checkspace(f1.oldpwd.value)){
		alert("请输入旧密码");