Hi Paul,
which version of Shindig are you running. In the current trunk, all tests
run fine here:
~/phx_buildout/Sites/asf_shindig_trunk/php $ phpunit
test/ShindigAllTests.php
PHPUnit 3.5.10 by Sebastian Bergmann.
...............................SSSSSS.......................... 63 / 420 (
15%)
............................................................... 126 / 420 (
30%)
............................................................... 189 / 420 (
45%)
............................................................... 252 / 420 (
60%)
............................................................... 315 / 420 (
75%)
............................................................... 378 / 420 (
90%)
..........................................
Time: 19 seconds, Memory: 42.50Mb
OK, but incomplete or skipped tests!
Tests: 420, Assertions: 839, Skipped: 6.
Writing code coverage data to XML file, this may take a moment.
Generating code coverage report, this may take a moment.
Note that the FilesServletTest (at least in the current trunk head) is not
dependent on any http calls. What happens in this test is, that the request
is mocked by directly calling the doGet method of the FilesServlet. The
FilesServlet just reads a file from a configurated path and writes it to
stdout. In this case the ContentFilesServlet tries to read the file
container/rpc_relay.html out of Config::get('javascript_path') which should
be pointing to the content directory in your shindig root. There should be a
subfolder with the expected rpc_relay.html file. In your setup the servlet
can not read this file from the filesystem and therefore just prints
"<html><body><h1>400 - Bad Request</h1></body></html>" and kills the php
instance. Agreed for unit tests this behaviour is not ideal because, but
there is also an issue for this (
https://issues.apache.org/jira/browse/SHINDIG-1338) which I'm planning to
implement sometime this month.
By the way: the rpc_relay.html file is used for older browsers to enable
JavaScript remote procedure calls between gadget and container which are
used in several features of the JavaScript API, this has nothing to do with
caja. Furthermore since caja is written in Java it is not implemented in the
PHP version at the moment. There are proposals available on how to do this (
https://issues.apache.org/jira/browse/SHINDIG-1008) but not in a state that
I would consider stable enough to apply (of course any help there would be
greatly appreciated :-).
Hpe this clears it up for you a bit
-- Bastian
2011/2/10 Paul-Armand Verhaegen <[email protected]>
> Dear,
>
> I've problems running the testsuite for Shindig php. The snippet below
> illustrates the encountered problem.
> Apparently, the problem is caused by FilesServletTest.
>
>
>
> -------------------------------------------------------------------------------------------------------------------
> developer@DragonDevMachine:/media/Datadisk/shindig$ phpunit --verbose
> ShindigAllTests ./test/ShindigAllTests.php
> PHPUnit 3.4.13 by Sebastian Bergmann.
>
> Shindig
> BasicBlobCrypterTest
> ....
>
> BasicRemoteContentTest
> .EEEEEEEEE
>
> ............... Took out some tests results here, basically all
> ok.........................
>
> ExpressionParserTest
> ...
>
> FilesServletTest
> .<html><body><h1>400 - Bad
> Request</h1></body></html>developer@DragonDevMachine
> :/media/Datadisk/shindig$
>
>
> -------------------------------------------------------------------------------------------------------------------
>
> I traced the error down to the call "$servlet->doGet();" in the following
> function (file test/gadgets/FilesServletTest.php):
>
>
> -------------------------------------------------------------------------------------------------------------------
> public function testContentHtml() {
> $servlet = new MockContentFilesServlet();
> $servlet->uri = 'container/rpc_relay.html';
> ob_start();
> $servlet->doGet();
> $servletContent = ob_get_contents();
> ob_end_clean();
> $fileContent = file_get_contents(Config::get('javascript_path')
> . $servlet->uri);
> $this->assertEquals($fileContent, $servletContent);
> }
>
>
> -------------------------------------------------------------------------------------------------------------------
>
> This is an expected result, since "container/rpc_relay.html" indeed doesn't
> exist on my localhost. If I'm not mistaking, the file has to do with
> cross-domain gadget security.
> If tried adding a try catch block in the testContentHtml() function, but to
> no avail. Should this file be added (I'm running virtualhosts with apache,
> and expected caja to handle all gadget js security).
>
> I'd like to request some guidance for this.
>
> Ps: I'm also wondering if I'm executing the testsuite correctly, and how to
> execute only REST tests.
> Ps2: If you believe this should have been posted in the Shindig users
> forum, I thought about it but though differently... not hesitate to correct
> me ;)
>
> Thank you in advance, Best regards,
> Paul