예제 #1
0
 public function testExecuteSoapRequest()
 {
     $mock_response = '<GetUserInfoResponse></GetUserInfoResponse>';
     $encoding = 'iso8859-1';
     $soap_options = $this->get_soap_options();
     $soap_client = $this->getMockBuilder('\\SoapClient')->setConstructorArgs([null, ['location' => $soap_options['location'], 'uri' => $soap_options['uri']]])->setMethods(['__doRequest'])->getMock();
     $soap_client->expects($this->any())->method('__doRequest')->with($this->anything(), $soap_options['location'], '', SOAP_1_1)->will($this->returnValue($mock_response));
     $tad_soap = $this->getMockBuilder('TADPHP\\Providers\\TADSoap')->setConstructorArgs([$soap_client, $soap_options])->setMethods(null)->getMock();
     $args = array_fill_keys(TAD::get_valid_commands_args(), null);
     $args['com_key'] = 0;
     $args['pin'] = 123;
     $response = $tad_soap->execute_soap_command('get_user_info', $args, $encoding);
     $this->assertNotEmpty($response);
 }
예제 #2
0
파일: TADTest.php 프로젝트: hew86i/timeattd
 public function testGetValidCommandsArgs()
 {
     $valid_args = TAD::get_valid_commands_args();
     $this->assertInternalType('array', $valid_args);
     $this->assertFalse($valid_args !== array_values($valid_args));
 }
예제 #3
0
 /**
  * @depends testDeviceIsOnLine
  */
 public function testRestartDevice(TAD $tad)
 {
     $expected_response = $this->build_expected_response('RestartResponse');
     $device_ip = $tad->get_ip();
     $response = $tad->restart();
     sleep(2);
     // Lets give it a few seconds to test if it's online.
     $is_device_online = TAD::is_device_online($device_ip);
     $this->assertEquals($expected_response, $response);
     $this->assertNotTrue($is_device_online);
 }