public function testUpdateMethodReturnsTrue() { $responseMock = $this->getMock('\\DynDNS\\Updater\\ResponseInterface'); $responseMock->expects($this->once())->method('getSuccess')->will($this->returnValue(true)); $providerMock = $this->getMock('\\DynDNS\\ProviderInterface'); $providerMock->expects($this->once())->method('update')->will($this->returnValue($responseMock)); $updater = new Updater($providerMock); $successful = $updater->update('foo.bar', '123.123.123.123', '2001:4860:4860::8888'); $this->assertTrue($successful); }
<?php /* * This file is part of the DynDNS library. * * (c) Andreas Weber <*****@*****.**> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ use DynDNS\Updater; use DynDNS\Provider\SchlundTech as SchlundTechProvider; // vars $host = 'home.example.de'; $ipv4 = '123.123.123.123'; $user = '******'; $password = '******'; $context = '10'; // get autoloader require __DIR__ . '/vendor/autoload.php'; // instantiate updater $updater = new Updater(new SchlundTechProvider($user, $password, $context)); // perform update $updater->update($host, $ipv4); // get response $response = $updater->getResponse(); var_dump($response);