1 |
richard.p.wagner |
106 |
<?php |
2 |
|
|
|
3 |
richard.p.wagner |
528 |
include('../config.inc'); |
4 |
richard.p.wagner |
106 |
|
5 |
|
|
require_once(SIMPLE_TEST . 'unit_tester.php'); |
6 |
|
|
require_once(SIMPLE_TEST . 'reporter.php'); |
7 |
|
|
|
8 |
richard.p.wagner |
528 |
require_once(BACKEND.'node.php'); |
9 |
richard.p.wagner |
734 |
require_once(BACKEND.'vospace.php'); |
10 |
richard.p.wagner |
106 |
|
11 |
|
|
class TestNode extends UnitTestCase { |
12 |
|
|
|
13 |
richard.p.wagner |
731 |
function setUp() { |
14 |
|
|
$this->node = new Node('ivo://example.org!vospace/bill_of_rights.txt'); |
15 |
richard.p.wagner |
106 |
} |
16 |
|
|
|
17 |
|
|
function testNewNode() { |
18 |
|
|
$this->assertNotNull($this->node); |
19 |
richard.p.wagner |
731 |
$this->assertEqual($this->node->uri, 'ivo://example.org!vospace/bill_of_rights.txt'); |
20 |
|
|
$this->assertEqual($this->node->file_path, FILE_SYSTEM_ROOT . 'bill_of_rights.txt'); |
21 |
richard.p.wagner |
106 |
} |
22 |
|
|
|
23 |
richard.p.wagner |
731 |
function testNodeExists() { |
24 |
|
|
$this->assertTrue($this->node->exists()); |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
function testNodeDoesntExist() { |
28 |
|
|
$false_node = new Node('ivo://example.org!vospace/foo.txt'); |
29 |
|
|
$this->assertFalse($false_node->exists()); |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
function testPropertySize(){ |
33 |
|
|
//bill_of_rights = 2821 bytes |
34 |
|
|
$this->node->populateProperties(); |
35 |
|
|
$this->assertEqual( $this->node->properties[0]["_"], "2821"); |
36 |
|
|
$this->assertEqual( $this->node->properties[1]["_"], DATA_OWNER); |
37 |
|
|
} |
38 |
richard.p.wagner |
734 |
|
39 |
|
|
function testGetProtocols(){ |
40 |
|
|
$protocols = $this->node->getProtocols(); |
41 |
|
|
$this->assertEqual( $protocols['endpoint'], |
42 |
|
|
'http://cadac-dev.ucsd.edu/vos/vospace/backends/file_system/sample_data/bill_of_rights.txt'); |
43 |
|
|
} |
44 |
richard.p.wagner |
106 |
} |
45 |
|
|
|
46 |
|
|
$test = &new TestNode(); |
47 |
|
|
$test->run(new HtmlReporter()); |
48 |
|
|
|
49 |
|
|
?> |