File/SyncML/tests/testsync.php

Description

Script to test the SyncML implementation.

Takes a pre-recorded testcase, stuffs the data into the SyncML server, and then compares the output to see if it matches.

See http://wiki.horde.org/SyncHowTo for a description how to create a test case.

$$Horde: framework/SyncML/tests/testsync.php,v 1.14.2.8 2009/01/06 15:23:39 jan Exp $

Copyright 2006-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Includes
 require_once ('SyncML/Backend.php') (line 88)
 require_once (HORDE_BASE.'/lib/core.php') (line 98)
 require_once (Log.php) (line 85)
 require_once ('SyncML/Device.php') (line 86)
 require_once (HORDE_BASE.'/lib/base.php') (line 106)
 require_once ('Horde/CLI.php') (line 99)
 require_once (SyncML.php) (line 39)

Script to test the SyncML implementation.

Takes a pre-recorded testcase, stuffs the data into the SyncML server, and then compares the output to see if it matches.

See http://wiki.horde.org/SyncHowTo for a description how to create a test case.

$$Horde: framework/SyncML/tests/testsync.php,v 1.14.2.8 2009/01/06 15:23:39 jan Exp $

Copyright 2006-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

 require_once ('SyncML/Device/Sync4j.php') (line 87)
Constants
AUTH_HANDLER = true (line 95)
HORDE_BASE = dirname(__FILE__).'/../../..' (line 96)
SYNCMLTEST_USERNAME = 'syncmltest' (line 41)
Functions
check (line 166)

Compares $r and $ref.

Exits if any nontrivial differences are found.

void check ( $name,  $r,  $ref, [ $packetnum = 'unknown'])
  • $name
  • $r
  • $ref
  • $packetnum
cmp (line 651)
void cmp ( $a,  $b)
  • $a
  • $b
convertAnchors (line 279)
void convertAnchors ( &$ref,  $r, [ $anchor = ''])
  • &$ref
  • $r
  • $anchor
decodebase64data (line 271)
void decodebase64data ( $s)
  • $s
getClient (line 152)

Retrieves the client data to be sent to the server

void getClient ( $name,  $number)
  • $name
  • $number
getResponse (line 230)

Simulates a call to the SyncML server by sending data to the server.

Returns the result received from the server.

void getResponse ( $data)
  • $data
getServer (line 141)

Retrieves the reference data for one packet.

void getServer ( $name,  $number)
  • $name
  • $number
getUIDs (line 255)
void getUIDs ( $data)
  • $data
parse_map (line 363)

Parses and stores the map info sent by the client.

void parse_map ( $content)
  • $content
print_usage (line 672)
void print_usage ([ $message = ''])
  • $message
sortChanges (line 623)

We can't know in which ordeer changes (Add|Replace|Delete) changes are

reported by the backend. One time it may list change1 and then change2, another time first change2 and then change1. So we just sort them to get a comparable result. The LocURIs must be ignored for the sort as we fake them during the test.

void sortChanges ( $content)
  • $content
test (line 593)

Executes one test case.

A test cases consists of various pre-recorded .xml packets in directory $name.

void test ( $name)
  • $name
testPre (line 387)

When a test case contains adds/modifies/deletes being sent to the server,

these changes must be extracted from the test data and manually performed using the api to achieve the desired behaviour by the server

void testPre ( $name,  $number)
  • $name
  • $number
testSession (line 309)

Tests one sync session.

Returns true on successful test and false on no (more) test data available for this $startnumber. Exits if test fails.

void testSession ( $name,  $startnumber,  &$anchor)
  • $name
  • $startnumber
  • &$anchor

Documentation generated on Sun, 30 Jan 2011 05:22:50 +0000 by phpDocumentor 1.4.3