function testWebDataTransclusionSource()
 {
     $spec = array('name' => 'FOO', 'keyFields' => 'id,name', 'optionNames' => 'x,y', 'url' => 'http://acme.com/{name}', 'dataFormat' => 'php', 'dataPath' => 'response/content/@0', 'fieldPathes' => array('id' => 'id/value', 'name' => 'name/value', 'info' => 'info/value'), 'errorPath' => 'response/error');
     $source = new WebDataTransclusionSource($spec);
     $u = $source->getRecordURL('name', 'foo&bar');
     $this->assertEquals('http://acme.com/foo%26bar', $u);
     $u = $source->getRecordURL('id', '23');
     $this->assertEquals('http://acme.com/?id=23', $u);
     $u = $source->getRecordURL('name', 'foo&bar', array('x' => '42', 'y' => 57));
     $this->assertEquals('http://acme.com/foo%26bar?x=42&y=57', $u);
     $rec = array("name" => array('type' => 'string', 'value' => "foo"), "id" => 3, "info" => array('type' => 'string', 'value' => "test X"));
     $data = array('response' => array('error' => 'test error', 'content' => array('foo' => $rec)));
     $data = serialize($data);
     $rec = $source->extractRecord($source->decodeData($data, 'php'));
     $err = $source->extractError($source->decodeData($data, 'php'));
     $this->assertEquals('test error', $err);
     $this->assertEquals(3, $rec['id']);
     //TODO: test extractField, with fancy snytax!
     //TODO: test flattenRecord
     ////////////////////////
     $spec['url'] = 'file://' . dirname(realpath(__FILE__)) . '/test-data-name-{name}.pser';
     $spec['dataFormat'] = 'php';
     $source = new WebDataTransclusionSource($spec);
     $rec = $source->fetchRecord('name', 'foo');
     $this->assertEquals(3, $rec['id']);
     ////////////////////////
     $spec['url'] = 'file://' . dirname(realpath(__FILE__)) . '/test-data-name-{name}.json';
     $spec['dataFormat'] = 'json';
     $source = new WebDataTransclusionSource($spec);
     $rec = $source->fetchRecord('name', 'foo');
     $this->assertEquals(3, $rec['id']);
     ////////////////////////
     if (function_exists('wddx_unserialize')) {
         $spec['url'] = 'file://' . dirname(realpath(__FILE__)) . '/test-data-name-{name}.wddx';
         $spec['dataFormat'] = 'wddx';
         $source = new WebDataTransclusionSource($spec);
         $rec = $source->fetchRecord('name', 'foo');
         $this->assertEquals(3, $rec['id']);
     }
 }