1 |
<?php |
2 |
|
3 |
include('../config.inc'); |
4 |
|
5 |
require_once(SIMPLE_TEST . 'unit_tester.php'); |
6 |
require_once(SIMPLE_TEST . 'reporter.php'); |
7 |
|
8 |
require_once('../vospace_service.php'); |
9 |
|
10 |
require_once('debug_funcs.php'); |
11 |
|
12 |
class target_node{ |
13 |
public $target; |
14 |
function __construct($tg) { |
15 |
$this->target = $tg; |
16 |
} |
17 |
} |
18 |
|
19 |
class TestVOSpaceService extends UnitTestCase { |
20 |
function setUp() { |
21 |
$this->vospace_server = new SoapServer('../vospace.wsdl', |
22 |
array('uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1')); |
23 |
$this->vospace_server->SetClass("VOSpaceService"); |
24 |
|
25 |
$this->service = new VOSpaceService(); |
26 |
|
27 |
} |
28 |
|
29 |
function testNewServer() { |
30 |
$this->assertNotNull($this->vospace_server); |
31 |
} |
32 |
|
33 |
function testFunctionsList() { |
34 |
|
35 |
$function_list = $this->vospace_server->getFunctions(); |
36 |
|
37 |
$this->assertNotNull($function_list); |
38 |
$this->assertTrue(in_array("ListNodes", $function_list)); |
39 |
// includes Security |
40 |
$this->assertEqual(count($function_list), 17); |
41 |
} |
42 |
|
43 |
function testProperties() { |
44 |
|
45 |
$prop_list = $this->service->GetProperties(); |
46 |
|
47 |
//barf_var($prop_list); |
48 |
|
49 |
$this->assertNotNull($prop_list); |
50 |
|
51 |
$size = $prop_list["provides"][0]; |
52 |
|
53 |
// properties are of a class Property |
54 |
$this->assertNotNull($size); |
55 |
$this->assertEqual($size["uri"], "ivo://net.ivoa.vospace/properties#size"); |
56 |
$this->assertEqual($size["readonly"], TRUE); |
57 |
} |
58 |
|
59 |
function testGetNode() { |
60 |
|
61 |
$node = $this->service->GetNode(new target_node('ivo://example.org!vospace/128cubed_hierarchy.png')); |
62 |
|
63 |
//barf_var($node); |
64 |
|
65 |
$this->assertNotNull($node["node"]); |
66 |
$this->assertEqual($node["node"]->properties[0]["_"], 569516); |
67 |
} |
68 |
|
69 |
} |
70 |
|
71 |
|
72 |
$test = &new TestVOSpaceService(); |
73 |
$test->run(new HtmlReporter()); |
74 |
|
75 |
?> |