Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestAccountService extends UnitTestCase
- {
- /**
- * The request data should enter the Account_Service in a format like this:
- *
- * $data = array( "api_sites_hostname" => "ibethel.org",
- * "api_first_name" => "chris",
- * "api_middle_name" => "danger",
- * "api_last_name" => "gratigny",
- * "api_main_phone" => "504-000-0000",
- * "api_mobile_phone" => "504-111-1111",
- * "api_work_phone" => "504-222-2222",
- * "api_versions_sites_id" => "ibethel.org",
- * "api_email" => "chrisg@ibethel.org",
- * "api_site_id" => "5",
- * "api_site_user_id" => "24"
- * );
- */
- function setUp()
- {
- parent::setUp();
- ObjectLoader::load_sites();
- $_POST["data"]=serialize($this->request_data_correct_auth_key());
- }
- function tearDown()
- {
- $_POST["data"]=NULL;
- parent::tearDown();
- }
- /**
- * Verfies that the "user_endpoint" method executes as expected, unserializing
- * the data sent in the POST into an array, calling the RequestParser, and
- * returning a User.
- * TODO: figure out alternative to the deprecated mock calls
- */
- function test_user_endpoint()
- {
- $controller = new Account_Service_Controller();
- $mock_request_parser = &new MockDefault_Request_Parser($this);
- $mock_request_parser->expectOnce( "parse", array(new EqualExpectation($this->request_data_correct_auth_key())));
- $mock_request_parser->setReturnValue( "parse", new Account_Model());
- $mock_filer = &new MockDefault_Filer( $this );
- $mock_filer ->expectOnce( "file", array( new IsAExpectation("Account_Model")));
- $controller->set_parser($mock_request_parser);
- $controller->set_filer($mock_filer);
- $controller->user_endpoint();
- }
Add Comment
Please, Sign In to add comment