/** * @depends testBuildTADZKLibIsOk */ public function testEncodeTime(TADZKLib $zk) { $expected_encoded_time = 480003771; // This integer represents '2014-12-07 14:22:51' timestamp. $dt = ['date' => '2014-12-07', 'time' => '14:22:51']; $t = ClassReflection::invoke_method($zk, 'setup_datetime', [$dt]); $encoded_time = ClassReflection::invoke_method($zk, 'encode_time', [$t]); $this->assertInternalType('integer', $encoded_time); $this->assertEquals($expected_encoded_time, $encoded_time); }
public function testExecuteMultipleSoapRequests() { $soap_requests = ['<GetDate><ArgComKey>0</ArgComKey></GetDate>', '<Restart><ArgComKey>0</ArgComKey></Restart>']; $mock_response = '<RestartResponse><Row><Result>1</Result><Information>Success!</Information></Row></RestartResponse>'; $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(); $result = ClassReflection::invoke_method($tad_soap, 'execute_multiple_soap_requests', [$soap_requests, $soap_options['location']]); $this->assertNotEmpty($result); }