Beispiel #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());
 }
Beispiel #2
0
 public function testClientGetsCorrectDeleteRequestWithReason()
 {
     $client = $this->getClient();
     $ripe = new WebService($client);
     $person = new RegObject('FOO');
     $ripe->delete($person, 'because I can!');
     $this->assertEquals('DELETE', $client->method);
     $this->assertEquals('https://rest-test.db.ripe.net/test/register/FOO?reason=because%20I%20can%21&password=emptypassword', $client->url);
     $this->assertNull($client->body);
 }