/** * Initializes the SoapClient object to make a request * * @return Exchange */ protected function initializeClient() { $options = array('user' => $this->username, 'password' => $this->password, 'version' => $this->version, 'location' => 'https://' . $this->server . '/EWS/Exchange.asmx', 'impersonation' => $this->impersonation, 'trace' => '1', 'exceptions' => true, 'classmap' => ClassMap::getClassMap()); $options = array_merge($options, $this->options); $client = new Exchange(dirname(__FILE__) . '/../../Resources/wsdl/services.wsdl', $options); $this->setClient($client); return $this; }
public function testClientInitialisation() { $client = new ExchangeWebServices('testServer', 'testUsername', 'testPassword', ['version' => 'testVersion']); $expected = new Exchange('https://testServer/EWS/Exchange.asmx', ExchangeWebServicesAuth::fromUsernameAndPassword('testUsername', 'testPassword'), dirname(__FILE__) . '/../../../Resources/wsdl/services.wsdl', array('version' => 'testVersion', 'impersonation' => null, 'trace' => 1, 'exceptions' => true, 'classmap' => ClassMap::getClassMap())); $this->assertEquals($expected, $client->getClient()); }
protected function createClient($server, $auth, $options) { $location = 'https://' . $this->cleanServerUrl($server) . '/EWS/Exchange.asmx'; $options = array_replace_recursive(['version' => self::VERSION_2007, 'trace' => 1, 'exceptions' => true, 'classmap' => ClassMap::getClassMap()], $options); $this->soap = new Exchange($location, $auth, dirname(__FILE__) . '/../../Resources/wsdl/services.wsdl', $options); if (isset($options['primarySmtpEmailAddress'])) { $this->setPrimarySmtpEmailAddress($options['primarySmtpEmailAddress']); } if (isset($options['impersonation'])) { $this->setPrimarySmtpEmailAddress($options['impersonation']); } }
public function testClientInitialisation() { $client = $this->getClientMock(); $client->setUsername('testUser'); $client->setPassword('testPassword'); $client->setVersion('testVersion'); $client->setServer('testServer'); $expected = new Exchange(dirname(__FILE__) . '/../../../Resources/wsdl/services.wsdl', array('user' => 'testUser', 'password' => 'testPassword', 'version' => 'testVersion', 'location' => 'https://testServer/EWS/Exchange.asmx', 'impersonation' => null, 'trace' => '1', 'exceptions' => true, 'classmap' => ClassMap::getClassMap())); $this->assertEquals($expected, $client->getClient()); $client->setClient('test'); $this->assertEquals('test', $client->getClient()); $client->setClient(false); $this->assertEquals($expected, $client->getClient()); }