/**
  *
  */
 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));
 }