Modified: incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/JsLibraryTest.php Sat Mar 7 12:27:45 2009 @@ -1,81 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * JsLibrary test case. - */ -class JsLibraryTest extends PHPUnit_Framework_TestCase { - - /** - * @var JsLibrary - */ - private $JsLibrary; - - /** - * @var type - */ - private $type = 'URL'; - - /** - * @var content - */ - private $content = ''; - - /** - * @var featureName - */ - private $featureName = ''; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - $this->JsLibrary = new JsLibrary($this->type, $this->content, $this->featureName); - - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - $this->JsLibrary = null; - parent::tearDown(); - } - - /** - * Tests JsLibrary->getContent() - */ - public function testGetContent() { - $content = trim($this->JsLibrary->getContent()); - $this->assertEquals($this->content, $content); - } - - /** - * Tests JsLibrary->toString() - */ - public function testToString() { - $output = $this->JsLibrary->toString(); - $this->assertEquals("<script src=\"" . $this->JsLibrary->getContent() . "\"></script>", $output); - - } - -} -
Modified: incubator/shindig/trunk/php/test/gadgets/LinkSpecTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/LinkSpecTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/LinkSpecTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/LinkSpecTest.php Sat Mar 7 12:27:45 2009 @@ -1,74 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * LinkSpec test case. - */ -class LinkSpecTest extends PHPUnit_Framework_TestCase { - - /** - * @var LinkSpec - */ - private $LinkSpec; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - $this->LinkSpec = new LinkSpec('rel', 'href', 'method'); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - $this->LinkSpec = null; - parent::tearDown(); - } - - /** - * Tests LinkSpec->__construct() - */ - public function test__construct() { - $this->LinkSpec = new LinkSpec('rel', 'href', 'method'); - } - - /** - * Tests LinkSpec->getHref() - */ - public function testGetHref() { - $this->assertEquals('href', $this->LinkSpec->getHref()); - } - - /** - * Tests LinkSpec->getMethod() - */ - public function testGetMethod() { - $this->assertEquals('method', $this->LinkSpec->getMethod()); - } - - /** - * Tests LinkSpec->getRel() - */ - public function testGetRel() { - $this->assertEquals('rel', $this->LinkSpec->getRel()); - } -} Modified: incubator/shindig/trunk/php/test/gadgets/LocaleSpecTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/LocaleSpecTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/LocaleSpecTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/LocaleSpecTest.php Sat Mar 7 12:27:45 2009 @@ -1,78 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * LocaleSpec test case. - */ -class LocaleSpecTest extends PHPUnit_Framework_TestCase { - - /** - * @var LocaleSpec - */ - private $LocaleSpec; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - $this->LocaleSpec = new LocaleSpec(); - $this->LocaleSpec->url = 'url'; - $this->LocaleSpec->locale = 'locale'; - $this->LocaleSpec->rightToLeft = 'rtl'; - $this->LocaleSpec->localeMessageBundles = array('foo'); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - $this->LocaleSpec = null; - parent::tearDown(); - } - - /** - * Tests LocaleSpec->getLocale() - */ - public function testGetLocale() { - $this->assertEquals('locale', $this->LocaleSpec->getLocale()); - } - - /** - * Tests LocaleSpec->getLocaleMessageBundles() - */ - public function testGetLocaleMessageBundles() { - $this->assertEquals(array('foo'), $this->LocaleSpec->getLocaleMessageBundles()); - } - - /** - * Tests LocaleSpec->getURI() - */ - public function testGetURI() { - $this->assertEquals('url', $this->LocaleSpec->getURI()); - } - - /** - * Tests LocaleSpec->isRightToLeft() - */ - public function testIsRightToLeft() { - $this->assertEquals('rtl', $this->LocaleSpec->isRightToLeft()); - } -} Modified: incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/MessageBundleParserTest.php Sat Mar 7 12:27:45 2009 @@ -1,86 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * MessageBundleParser test case. - */ -class MessageBundleParserTest extends PHPUnit_Framework_TestCase { - - /** - * @var MessageBundleParser - */ - private $MessageBundleParser; - private $MessageBundle; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - - $this->MessageBundleParser = new MessageBundleParser(/* parameters */); - - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - - $this->MessageBundleParser = null; - $this->MessageBundle = null; - parent::tearDown(); - } - - /** - * Tests MessageBundleParser->parse() - */ - public function testParse() { - $xml = '<?xml version="1.0" encoding="UTF-8" ?> -<doc> - <msg name="name1">Message 1</msg> - <msg name="name2">Message 2</msg> - <msg name="name3">Message 3</msg> - <msg name="name4">Message 4</msg> -</doc>'; - - $this->MessageBundle = $this->MessageBundleParser->parse($xml); - - $this->assertEquals('Message 1', $this->MessageBundle['name1']); - $this->assertEquals('Message 2', $this->MessageBundle['name2']); - $this->assertEquals('Message 3', $this->MessageBundle['name3']); - $this->assertEquals('Message 4', $this->MessageBundle['name4']); - } - - /** - * Tests MessageBundleParser->parse() on error xml string. - */ - public function testParseOnError() { - $xml = '<?xml version="1.0" encoding="UTF-8" ?> -<doc> - <msg name="name1">Message 1</msg> - <msg name="name2">Message 2</msg> - <msg name="name3">Message 3</msg> - <msg name="name4">Message 4</msg>'; - $this->setExpectedException('Exception'); - $this->MessageBundle = $this->MessageBundleParser->parse($xml); - } -} - Modified: incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/MessageBundleTest.php Sat Mar 7 12:27:45 2009 @@ -1,62 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * MessageBundle test case. - */ -class MessageBundleTest extends PHPUnit_Framework_TestCase { - - /** - * @var MessageBundle - */ - private $MessageBundle; - - /** - * @var Message - */ - private $Messages = array('Dummie Message', 'Hello World'); - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - $this->MessageBundle = new MessageBundle($this->Messages); - - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - $this->MessageBundle = null; - parent::tearDown(); - } - - /** - * Tests MessageBundle->getMessages() - */ - public function testGetMessages() { - $this->assertEquals($this->Messages, $this->MessageBundle->getMessages()); - - } - -} - Modified: incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/UserPrefsTest.php Sat Mar 7 12:27:45 2009 @@ -1,88 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * UserPrefs test case. - */ -class UserPrefsTest extends PHPUnit_Framework_TestCase { - - /** - * @var UserPrefs - */ - private $UserPrefs; - - /** - * @var UserPrefsArrays - */ - private $UserPrefsArrays = array('Test1' => 'value for test1', 'Test2' => 'value for test2'); - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - $this->UserPrefs = new UserPrefs($this->UserPrefsArrays); - - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - $this->UserPrefs = null; - - parent::tearDown(); - } - - /** - * Tests UserPrefs->getPref() - */ - public function testGetPref() { - $this->assertEquals($this->UserPrefsArrays['Test1'], $this->UserPrefs->getPref('Test1')); - - } - - /** - * Tests UserPrefs->getPrefs() - */ - public function testGetPrefs() { - $this->assertEquals($this->UserPrefsArrays, $this->UserPrefs->getPrefs()); - - } - - /** - * Tests UserPrefs->getPrefs() - */ - public function testGetPrefsReturn() { - $key = 'Test1'; - $this->assertEquals($this->UserPrefsArrays[$key], $this->UserPrefs->getPref($key)); - - } - - /** - * Tests UserPrefs->getPrefs() - */ - public function testGetPrefsReturnNull() { - $key = 'non_existing_key'; - $this->assertNull($this->UserPrefs->getPref($key)); - - } -} - Modified: incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php (original) +++ incubator/shindig/trunk/php/test/gadgets/ViewSpecTest.php Sat Mar 7 12:27:45 2009 @@ -1,75 +0,0 @@ -<?php -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * ViewSpec test case. - */ -class ViewSpecTest extends PHPUnit_Framework_TestCase { - - /** - * @var ViewSpec - */ - private $ViewSpec; - - /** - * @var GadgetXML - */ - private $GadgetXML = '<?xml version="1.0" encoding="UTF-8" ?> -<Module> - <ModulePrefs title="Dummie gadget" /> - <Require feature="rpc"> - </Require> - <Content type="html"> - <![CDATA[<h1>Hello, world!</h1>]]> - </Content> -</Module> - '; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() { - parent::setUp(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() { - parent::tearDown(); - } - - /** - * Tests ViewSpec->__construct() - */ - public function test__construct() { - $doc = simplexml_load_string($this->GadgetXML, 'SimpleXMLElement', LIBXML_NOCDATA); - $content = $doc->Content[0]; - $attributes = $content->attributes(); - $view = isset($attributes['view']) ? trim($attributes['view']) : DEFAULT_VIEW; - $attributes['type'] = 'url'; - - $this->setExpectedException('SpecParserException'); - $this->ViewSpec = new ViewSpec($view, $content); - - } - -} - Modified: incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php (original) +++ incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php Sat Mar 7 12:27:45 2009 @@ -53,9 +53,9 @@ $servletRequest = array('url' => '/people/1/@self'); $requestItem = RestRequestItem::createWithRequest($servletRequest, null, $inputConverter, $outputConverter); $requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}"); - $response = array( - 'entry' => array('isOwner' => false, 'isViewer' => false, 'displayName' => '1 1', - 'id' => '1')); + $entry = array('isOwner' => false, 'isViewer' => false, + 'displayName' => '1 1', 'id' => '1'); + $response = new DataCollection($entry); $responseItem = new ResponseItem(null, null, $response); ob_start(); $outputConverter->outputResponse($responseItem, $requestItem); Modified: incubator/shindig/trunk/php/test/social/OutputJsonConverterTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/OutputJsonConverterTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/social/OutputJsonConverterTest.php (original) +++ incubator/shindig/trunk/php/test/social/OutputJsonConverterTest.php Sat Mar 7 12:27:45 2009 @@ -22,7 +22,7 @@ * OutputJsonConverter test case. */ class OutputJsonConverterTest extends PHPUnit_Framework_TestCase { - + /** * @var OutputJsonConverter */ Modified: incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php?rev=751254&r1=751253&r2=751254&view=diff ============================================================================== --- incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php (original) +++ incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php Sat Mar 7 12:27:45 2009 @@ -53,9 +53,9 @@ $servletRequest = array('url' => '/people/1/@self'); $requestItem = RestRequestItem::createWithRequest($servletRequest, null, $inputConverter, $outputConverter); $requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}"); - $response = array( - 'entry' => array('isOwner' => false, 'isViewer' => false, 'displayName' => '1 1', - 'id' => '1')); + $entry = array('isOwner' => false, 'isViewer' => false, + 'displayName' => '1 1', 'id' => '1'); + $response = new DataCollection($entry); $responseItem = new ResponseItem(null, null, $response); ob_start(); $outputConverter->outputResponse($responseItem, $requestItem);
