コード例 #1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $user = new User();
     $user->Forename = "Alice";
     $user->Surname = "Smith";
     $user->Save();
     $user = new User();
     $user->Forename = "Bob";
     $user->Surname = "Diamond";
     $user->Save();
 }
コード例 #2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $user = new User();
     $user->Username = "******";
     $user->Password = '******';
     $user->Active = 1;
     $user->Save();
     $user = new User();
     $user->Username = "******";
     $user->Password = '******';
     $user->Active = 0;
     $user->Save();
     $testLoginProvider = new TestLoginProvider();
     $testLoginProvider->LogOut();
 }
コード例 #3
0
 public function testUrlWithBothIDAndActionGetsRelevantPresenter()
 {
     $crud = new CrudUrlHandler("Rhubarb\\Stem\\UnitTesting\\User", "Rhubarb\\Leaf\\UnitTesting\\Presenters\\Cruds2");
     $crud->SetUrl("/users/");
     $user = new User();
     $user->Forename = "Goat";
     $user->Save();
     $request = new WebRequest();
     $request->UrlPath = "/users/" . $user->UniqueIdentifier . "/edit/";
     $request->Server("HTTP_ACCEPT", "text/html");
     $request->Server("REQUEST_METHOD", "get");
     $response = $crud->GenerateResponse($request);
     $this->assertInstanceOf("Rhubarb\\Leaf\\UnitTesting\\Presenters\\Cruds2\\Cruds2EditPresenter", $response->GetGenerator());
     $this->assertFalse($response->GetGenerator()->GetRestModel()->IsNewRecord());
     $this->assertEquals("Goat", $response->GetContent());
     $request = new WebRequest();
     $request->UrlPath = "/users/" . $user->UniqueIdentifier . "/";
     $request->Server("HTTP_ACCEPT", "text/html");
     $request->Server("REQUEST_METHOD", "get");
     $response = $crud->GenerateResponse($request);
     $this->assertInstanceOf("Rhubarb\\Leaf\\UnitTesting\\Presenters\\Cruds2\\Cruds2ItemPresenter", $response->GetGenerator());
 }