示例#1
0
 public function testConvertResponse()
 {
     $client = $this->getClient('haiku');
     $ripe = new WebService($client);
     $haiku = new Poem('POEM-HAIKU-OBJECT');
     $haiku['form'] = 'FORM-HAIKU';
     $haiku['text'] = '...';
     $haiku['mnt-by'] = 'CROSSLINE-MNT';
     $haiku = $ripe->create($haiku);
     $this->assertEquals('POEM-HAIKU-OBJECT', $haiku['poem']);
     $this->assertEquals('FORM-HAIKU', $haiku['form']);
     $this->assertEquals('CROSSLINE-MNT', $haiku['mnt-by']);
     // object => string conversion!
     $this->assertEquals(["The haiku object", "Never came to life as such", "It's now generic"], $haiku['text']);
     $this->assertEquals(['RSP-RIPE'], $haiku['author']);
     $this->assertEquals('2005-06-14T11:27:26Z', $haiku['created']);
     $this->assertEquals('2005-06-14T14:38:27Z', $haiku['last-modified']);
     $mntner = $haiku['mnt-by'];
     $this->assertEquals('mntner', $mntner->getType());
     $this->assertInstanceOf('\\Dormilich\\WebService\\RIPE\\RPSL\\Mntner', $mntner->getObject());
     $this->assertEquals('http://rest.db.ripe.net/ripe/mntner/CROSSLINE-MNT', $mntner->getLink());
 }
示例#2
0
 public function testClientGetsCorrectCreateUrlAfterChange()
 {
     $client = $this->getClient();
     $ripe = new WebService($client);
     $obj = new RegObject('create');
     $ripe->setEnvironment(WebService::PRODUCTION);
     $ripe->setPassword('super-secret');
     $ripe->create($obj);
     $this->assertEquals('https://rest.db.ripe.net/ripe/register?password=super-secret', $client->url);
 }