Exemple #1
0
<?php

// Include the required files
require '../src/TubewarderRestClient.php';
// Import the classes
use Tubewarder\TubewarderRestClient;
use Tubewarder\SendRequest;
use Tubewarder\Address;
use Tubewarder\ErrorCode;
// Create a new client
$client = new TubewarderRestClient('http://*****:*****@weweave.net', 'weweave GbR'));
$sr->setEcho(true);
$sr->setKeyword('UnitTest');
$sr->setDetails('php unit test testSendSuccess()');
$sr->addModelParam('firstname', 'John');
$sr->addModelParam('code', '123456');
try {
    // Send the request
    $res = $client->send($sr);
    // We received a response code from the server
    if ($res->getError() == ErrorCode::OK) {
        echo "Success!\n";
    } else {
        echo "Error code: " . $res->getError() . "\n";
    }
} catch (Exception $e) {
 public function testConstructorWithTrailingSlash()
 {
     $client = new TubewarderRestClient('http://localhost:8080/');
     $this->assertEquals('http://localhost:8080/', $client->getUri());
 }