PHP Classes

File: ANYEM_CLIENT/anyem.client.tst/AnyemClientTest.php

Recommend this page to a friend!
  Classes of Anis Halayem  >  Anyem  >  ANYEM_CLIENT/anyem.client.tst/AnyemClientTest.php  >  Download  
File: ANYEM_CLIENT/anyem.client.tst/AnyemClientTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Anyem
Exchange variable values between PHP servers
Author: By
Last change:
Date: 4 years ago
Size: 1,327 bytes
 

Contents

Class file image Download
<?php
set_time_limit
(0) ;

/**
 *
 * @author Anis.Halayem
 */
class AnyemClientTest extends PHPUnit_Framework_TestCase {
   
    public function
setUp() {
        require_once (
__DIR__ . '/../../ANYEM_SHARED/' . 'anyem.resource.impl/ResourceIdentifierImpl.php');
        require_once (
__DIR__ . '/../../ANYEM_SHARED/' . 'anyem.resource.impl/ResponseWrapperImpl.php') ;

        require_once (
__DIR__ . '/../anyem.client.impl/ClientConnectionImpl.php');
        require_once (
__DIR__ . '/../anyem.client.impl/AnyemClientImpl.php');
    }
   
    public function
testGetPut() {
       
$expected = $iteration = 2000;
       
       
$clientConnection = ClientConnectionImpl::newClient();
       
$identifier = new ResourceIdentifierImpl("anyem.com", "anyemNameSpace", "a");
       
$anyemClient = new AnyemClientImpl($clientConnection, $identifier);
       
       
$a = 0;
        for (
$i=0 ; $i<$iteration ; $i++) {
            try {
               
$responseWrapper = $anyemClient->get($a, 10, 300000);
               
            }catch (
Exception $e) {
                print
$e->getMessage() . "\n";
                continue;
            }

           
$a = $responseWrapper->getResource()->getData();
           
$anyemClient->put(++$a);
        }
       
$this->assertEquals($expected, $a);
    }
}


For more information send a message to info at phpclasses dot org.