예제 #1
0
 function testRemotelyCallsAMethodOnAManagedObject()
 {
     $aManagedObject = $this->aManagedObject();
     # We need to use a method defined in the vimService so we will use the CreateSnapshot_Task defined on a VirtualMachine
     $this->vmwareSoapClient->expects($this->once())->method('CreateSnapshot_Task')->with(\Vmwarephp\Factory\SoapMessage::makeUsingManagedObject($aManagedObject, array()))->will($this->returnValue(new stdClass()));
     $this->vmWareService->__call('CreateSnapshot_Task', array($aManagedObject, array()));
 }
예제 #2
0
 function __call($method, $arguments)
 {
     if ($this->isMethodAPropertyRetrieval($method)) {
         return $this->getQueriedProperty($method, $arguments);
     }
     $managedObject = $arguments[0];
     $actionArguments = isset($arguments[1]) ? $arguments[1] : array();
     return $this->makeSoapCall($method, \Vmwarephp\Factory\SoapMessage::makeUsingManagedObject($managedObject, $actionArguments));
 }
예제 #3
0
 function testItMakesASoapMessageForAMethodCallOnAManagedObject()
 {
     $service = \Mockery::mock('\\Vmwarephp\\Service');
     $reference = new ManagedObjectReference('vm151', 'VirtualMachine');
     $managedObject = new \Vmwarephp\ManagedObject($service, $reference);
     # Method invocation arguments will be passed as an array of arrays
     $arguments = array(array('firstArgument'), array('secondArgument'));
     $expectedMessage = array('_this' => $reference, 'firstArgument', 'secondArgument');
     $this->assertEquals($expectedMessage, \Vmwarephp\Factory\SoapMessage::makeUsingManagedObject($managedObject, $arguments));
 }