コード例 #1
0
 public function testCallGetLocationListMethod()
 {
     TestDataService::populate($this->locationFixture);
     $paramObj = new WSRequestParameters();
     $paramObj->setAppId(1);
     $paramObj->setAppToken('1234567890');
     $paramObj->setMethod('getLocationList');
     $paramObj->setSessionToken(uniqid('ohrm_ws_session_'));
     $paramObj->setParameters(array(0));
     $paramObj->setRequestMethod('GET');
     $mock = $this->getMock('AdminWebServiceHelper', array('getAccessibleLocations'));
     $mock->method('getAccessibleLocations')->will($this->returnValue(array()));
     $this->adminWebServiceWrapper->setServiceInstance($mock);
     $paramObj->setWrapperObject($this->adminWebServiceWrapper);
     $result = $this->manager->callMethod($paramObj);
     $this->assertNotNull($result);
     foreach ($this->locationTestCases['Location'] as $key => $testCase) {
         $this->assertEquals($result[$key]['id'], $testCase['id']);
         $this->assertEquals($result[$key]['locationName'], $testCase['name']);
         $this->assertEquals($result[$key]['country_code'], $testCase['country_code']);
         $this->assertEquals($result[$key]['province'], $testCase['province']);
         $this->assertEquals($result[$key]['city'], $testCase['city']);
         $this->assertEquals($result[$key]['address'], $testCase['address']);
     }
 }