Permalink
Browse files

Merge pull request #1581 from elkuku/phpcs-tests-fix-n2

Fix code style in tests folder
  • Loading branch information...
2 parents 120165a + 916f155 commit 0fb38b477e4cd272061f22274e2a18620499bfed @LouisLandry LouisLandry committed Oct 8, 2012
Showing with 6,555 additions and 3,857 deletions.
  1. +3 −1 tests/core/case/case.php
  2. +3 −1 tests/core/case/database.php
  3. +1 −1 tests/suites/database/driver/mysql/iterator/JDatabaseIteratorMySQLTest.php
  4. +33 −32 tests/suites/unit/JLoaderTest.php
  5. +14 −14 tests/suites/unit/joomla/JFactoryTest.php
  6. +39 −27 tests/suites/unit/joomla/JPlatformTest.php
  7. +26 −12 tests/suites/unit/joomla/access/JAccessTest.php
  8. +30 −27 tests/suites/unit/joomla/access/JRuleTest.php
  9. +93 −69 tests/suites/unit/joomla/access/JRulesTest.php
  10. +17 −16 tests/suites/unit/joomla/application/JApplicationCliTest.php
  11. +66 −43 tests/suites/unit/joomla/application/JApplicationWebTest.php
  12. +145 −33 tests/suites/unit/joomla/application/JRouterTest.php
  13. +20 −10 tests/suites/unit/joomla/archive/JArchiveBzip2Test.php
  14. +19 −3 tests/suites/unit/joomla/archive/JArchiveGzipTest.php
  15. +16 −4 tests/suites/unit/joomla/archive/JArchiveTarTest.php
  16. +27 −9 tests/suites/unit/joomla/archive/JArchiveTest.php
  17. +18 −0 tests/suites/unit/joomla/archive/JArchiveZipInspector.php
  18. +67 −45 tests/suites/unit/joomla/archive/JArchiveZipTest.php
  19. +8 −0 tests/suites/unit/joomla/base/JAdapterInstanceTest.php
  20. +4 −0 tests/suites/unit/joomla/base/JAdapterTest.php
  21. +7 −0 tests/suites/unit/joomla/base/stubs/testadapter.php
  22. +1 −0 tests/suites/unit/joomla/base/stubs/testadapter2.php
  23. +7 −0 tests/suites/unit/joomla/base/stubs/testadapter3.php
  24. +7 −0 tests/suites/unit/joomla/base/stubs/testadapter4.php
  25. +36 −10 tests/suites/unit/joomla/cache/JCacheConstructTest.php
  26. +131 −86 tests/suites/unit/joomla/cache/JCacheControllerTest.php
  27. +61 −44 tests/suites/unit/joomla/cache/JCacheStorageTest.php
  28. +164 −152 tests/suites/unit/joomla/cache/JCacheTest.php
  29. +40 −4 tests/suites/unit/joomla/cache/controller/JCacheControllerCallback.helper.php
  30. +62 −30 tests/suites/unit/joomla/cache/controller/JCacheControllerCallbackCallbackTest.php
  31. +19 −12 tests/suites/unit/joomla/cache/controller/JCacheControllerCallbackTest.php
  32. +15 −11 tests/suites/unit/joomla/cache/controller/JCacheControllerOutputTest.php
  33. +27 −14 tests/suites/unit/joomla/cache/controller/JCacheControllerPageTest.php
  34. +14 −4 tests/suites/unit/joomla/cache/controller/JCacheControllerRaw.php
  35. +17 −12 tests/suites/unit/joomla/cache/controller/JCacheControllerViewTest.php
  36. +25 −16 tests/suites/unit/joomla/cache/storage/JCacheStorageApcTest.php
  37. +131 −86 tests/suites/unit/joomla/cache/storage/JCacheStorageCacheliteTest.php
  38. +40 −14 tests/suites/unit/joomla/cache/storage/JCacheStorageFileTest.php
  39. +52 −37 tests/suites/unit/joomla/cache/storage/JCacheStorageHelperTest.php
  40. +105 −41 tests/suites/unit/joomla/cache/storage/JCacheStorageMainTest.php
  41. +32 −6 tests/suites/unit/joomla/cache/storage/JCacheStorageMemcacheTest.php
  42. +44 −31 tests/suites/unit/joomla/cache/storage/JCacheStorageMock.php
  43. +131 −86 tests/suites/unit/joomla/cache/storage/JCacheStorageWincacheTest.php
  44. +46 −21 tests/suites/unit/joomla/cache/storage/JCacheStorageXCacheTest.php
  45. +120 −4 tests/suites/unit/joomla/client/JClientFtpTest.php
  46. +24 −4 tests/suites/unit/joomla/client/JClientHelperTest.php
  47. +92 −4 tests/suites/unit/joomla/client/JClientLdapTest.php
  48. +36 −8 tests/suites/unit/joomla/crypt/JCryptTest.php
  49. +15 −4 tests/suites/unit/joomla/crypt/cipher/JCryptCipher3DESTest.php
  50. +15 −4 tests/suites/unit/joomla/crypt/cipher/JCryptCipherBlowfishTest.php
  51. +15 −4 tests/suites/unit/joomla/crypt/cipher/JCryptCipherRijndael256Test.php
  52. +21 −10 tests/suites/unit/joomla/crypt/cipher/JCryptCipherSimpleTest.php
  53. +33 −11 tests/suites/unit/joomla/crypt/password/JCryptPasswordSimpleTest.php
  54. +13 −6 tests/suites/unit/joomla/database/JDatabaseQueryElementInspector.php
  55. +47 −39 tests/suites/unit/joomla/database/JDatabaseQueryElementTest.php
  56. +12 −5 tests/suites/unit/joomla/database/JDatabaseQueryInspector.php
  57. +76 −57 tests/suites/unit/joomla/database/JDatabaseQueryTest.php
  58. +49 −8 tests/suites/unit/joomla/database/JDatabaseTest.php
  59. +20 −7 tests/suites/unit/joomla/database/database/JDatabaseExporterMySqlInspector.php
  60. +61 −44 tests/suites/unit/joomla/database/database/JDatabaseExporterMySqlTest.php
  61. +18 −9 tests/suites/unit/joomla/database/database/JDatabaseExporterMySqliTest.php
  62. +4 −4 tests/suites/unit/joomla/database/database/JDatabaseExporterPostgresqlInspector.php
  63. +4 −4 tests/suites/unit/joomla/database/database/JDatabaseExporterPostgresqlTest.php
  64. +38 −16 tests/suites/unit/joomla/database/database/JDatabaseImporterMySqlInspector.php
  65. +93 −56 tests/suites/unit/joomla/database/database/JDatabaseImporterMySqlTest.php
  66. +18 −9 tests/suites/unit/joomla/database/database/JDatabaseImporterMySqliTest.php
  67. +4 −4 tests/suites/unit/joomla/database/database/JDatabaseImporterPostgresqlInspector.php
  68. +4 −4 tests/suites/unit/joomla/database/database/JDatabaseImporterPostgresqlTest.php
  69. +4 −4 tests/suites/unit/joomla/database/database/JDatabasePostgresqlQueryTest.php
  70. +105 −4 tests/suites/unit/joomla/database/database/JDatabaseSQLSrvTest.php
  71. +2 −2 tests/suites/unit/joomla/database/stubs/nosqldriver.php
  72. +40 −36 tests/suites/unit/joomla/date/JDateTest.php
  73. +16 −6 tests/suites/unit/joomla/document/JDocumentRendererTest.php
  74. +189 −18 tests/suites/unit/joomla/document/JDocumentTest.php
  75. +85 −56 tests/suites/unit/joomla/document/error/JDocumentErrorTest.php
  76. +19 −3 tests/suites/unit/joomla/document/feed/JDocumentFeedTest.php
  77. +37 −24 tests/suites/unit/joomla/document/feed/JFeedEnclosureTest.php
  78. +37 −24 tests/suites/unit/joomla/document/feed/JFeedImageTest.php
  79. +51 −37 tests/suites/unit/joomla/document/feed/JFeedItemTest.php
  80. +36 −23 tests/suites/unit/joomla/document/feed/renderer/JDocumentRendererAtomTest.php
  81. +37 −21 tests/suites/unit/joomla/document/feed/renderer/JDocumentRendererRSSTest.php
  82. +216 −147 tests/suites/unit/joomla/document/html/JDocumentHTMLTest.php
  83. +51 −37 tests/suites/unit/joomla/document/html/renderer/JDocumentRendererComponentTest.php
  84. +66 −47 tests/suites/unit/joomla/document/html/renderer/JDocumentRendererHeadTest.php
  85. +51 −37 tests/suites/unit/joomla/document/html/renderer/JDocumentRendererMessageTest.php
  86. +51 −37 tests/suites/unit/joomla/document/html/renderer/JDocumentRendererModuleTest.php
  87. +51 −37 tests/suites/unit/joomla/document/html/renderer/JDocumentRendererModulesTest.php
  88. +22 −6 tests/suites/unit/joomla/document/json/JDocumentJSONTest.php
  89. +30 −8 tests/suites/unit/joomla/document/opensearch/JDocumentOpensearchTest.php
  90. +37 −24 tests/suites/unit/joomla/document/opensearch/JOpenSearchImageTest.php
  91. +37 −24 tests/suites/unit/joomla/document/opensearch/JOpenSearchUrlTest.php
  92. +17 −4 tests/suites/unit/joomla/document/raw/JDocumentRAWTest.php
  93. +31 −3 tests/suites/unit/joomla/document/xml/JDocumentXMLTest.php
  94. +90 −15 tests/suites/unit/joomla/environment/JBrowserTest.php
  95. +71 −12 tests/suites/unit/joomla/environment/JResponseTest.php
  96. +28 −22 tests/suites/unit/joomla/event/JEventDispatcherInspector.php
  97. +408 −394 tests/suites/unit/joomla/event/JEventDispatcherTest.php
  98. +33 −21 tests/suites/unit/joomla/event/JEventInspector.php
  99. +9 −2 tests/suites/unit/joomla/event/JEventStub.php
  100. +71 −63 tests/suites/unit/joomla/event/JEventTest.php
  101. +190 −124 tests/suites/unit/joomla/filesystem/JFileTest.php
  102. +119 −71 tests/suites/unit/joomla/filesystem/JFilesystemHelperTest.php
  103. +34 −34 tests/suites/unit/joomla/filesystem/JFilesystemPatcherTest.php
  104. +123 −83 tests/suites/unit/joomla/filesystem/JFolderTest.php
  105. +40 −12 tests/suites/unit/joomla/filesystem/JPathTest.php
  106. +441 −297 tests/suites/unit/joomla/filesystem/JStreamTest.php
  107. +171 −117 tests/suites/unit/joomla/filesystem/streams/JStreamStringTest.php
  108. +74 −50 tests/suites/unit/joomla/filesystem/support/JStringControllerTest.php
  109. +83 −82 tests/suites/unit/joomla/filter/JFilterInputTest.php
  110. +17 −13 tests/suites/unit/joomla/filter/JFilterOutputTest.php
  111. +17 −3 tests/suites/unit/joomla/form/JFormDataHelper.php
  112. +77 −56 tests/suites/unit/joomla/form/JFormFieldTest.php
  113. +22 −6 tests/suites/unit/joomla/form/JFormRuleTest.php
  114. +423 −321 tests/suites/unit/joomla/form/JFormTest.php
  115. +1 −1 tests/suites/unit/joomla/form/_testfields/bar.php
Sorry, we could not display the entire diff because it was too big.
View
4 tests/core/case/case.php
@@ -426,7 +426,9 @@ protected function setErrorHandlers($errorHandlers)
*
* @param string $testName The name of the test class for which to set the error callback method.
*
- * @return void
+ * @param string $testName The test name.
+ *
+ * @return void
*
* @since 12.1
*/
View
4 tests/core/case/database.php
@@ -463,7 +463,9 @@ protected function setErrorHandlers($errorHandlers)
*
* @param string $testName The name of the test class for which to set the error callback method.
*
- * @return void
+ * @param string $testName The test name.
+ *
+ * @return void
*
* @since 12.1
*/
View
2 tests/suites/database/driver/mysql/iterator/JDatabaseIteratorMySQLTest.php
@@ -140,7 +140,7 @@ public function casesForEachData()
*
* @dataProvider casesForEachData
*
- * @since 12.1
+ * @since 12.1
*/
public function testForEach($select, $from, $column, $class, $limit, $offset, $expected, $exception)
{
View
65 tests/suites/unit/JLoaderTest.php
@@ -127,7 +127,8 @@ public function testDiscover()
'Checks that the original class paths are maintained when not forced.'
);
- $this->assertThat(isset($classes['atlantis']), $this->isFalse(), 'Checks that directory was not recursed.');
+ $this->assertThat(
+ isset($classes['atlantis']), $this->isFalse(), 'Checks that directory was not recursed.');
JLoader::discover('Shuttle', __DIR__ . '/stubs/discover2', true, true);
$classes = JLoader::getClassList();
@@ -229,13 +230,13 @@ public function testJimport($object, $expect, $message)
}
/**
- * Tests the JLoader::register method.
- *
- * @return void
- *
- * @since 11.1
- * @covers JLoader::register
- */
+ * Tests the JLoader::register method.
+ *
+ * @return void
+ *
+ * @since 11.1
+ * @covers JLoader::register
+ */
public function testRegister()
{
JLoader::register('BogusLoad', $this->bogusFullPath);
@@ -256,44 +257,44 @@ public function testRegister()
}
/**
- * Tests the JLoader::registerPrefix method.
- *
- * @return void
- *
- * @since 12.1
- * @covers JLoader::registerPrefix
- * @todo Implement testRegisterPrefix().
- */
+ * Tests the JLoader::registerPrefix method.
+ *
+ * @return void
+ *
+ * @since 12.1
+ * @covers JLoader::registerPrefix
+ * @todo Implement testRegisterPrefix().
+ */
public function testRegisterPrefix()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
/**
- * Tests the exception thrown by the JLoader::registerPrefix method.
- *
- * @return void
- *
- * @since 12.1
- * @covers JLoader::registerPrefix
- * @expectedException RuntimeException
- */
+ * Tests the exception thrown by the JLoader::registerPrefix method.
+ *
+ * @return void
+ *
+ * @since 12.1
+ * @covers JLoader::registerPrefix
+ * @expectedException RuntimeException
+ */
public function testRegisterPrefixException()
{
JLoader::registerPrefix('P', __DIR__ . '/doesnotexist');
}
/**
- * Tests the JLoader::setup method.
- *
- * @return void
- *
- * @since 11.4
- * @covers JLoader::setup
- */
+ * Tests the JLoader::setup method.
+ *
+ * @return void
+ *
+ * @since 11.4
+ * @covers JLoader::setup
+ */
public function testSetup()
{
$loaders = spl_autoload_functions();
View
28 tests/suites/unit/joomla/JFactoryTest.php
@@ -62,7 +62,7 @@ function testGetApplication()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
@@ -83,8 +83,8 @@ function testGetConfig()
$this->assertInstanceOf(
'JRegistry',
- JFactory::getConfig(JPATH_TESTS.'/config.php'),
- 'Line: '.__LINE__
+ JFactory::getConfig(JPATH_TESTS . '/config.php'),
+ 'Line: ' . __LINE__
);
JFactory::$config = $temp;
@@ -105,11 +105,11 @@ function testGetLanguage()
$this->assertInstanceOf(
'JLanguage',
JFactory::getLanguage(),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
$this->markTestIncomplete(
- 'This test has not been implemented completely yet.'
+ 'This test has not been implemented completely yet.'
);
}
@@ -130,13 +130,13 @@ function testGetDocument()
$this->assertInstanceOf(
'JDocument',
JFactory::getDocument(),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
JFactory::$application = null;
$this->markTestIncomplete(
- 'This test has not been implemented completely yet.'
+ 'This test has not been implemented completely yet.'
);
}
@@ -154,23 +154,23 @@ function testGetCache()
$this->assertInstanceOf(
'JCacheController',
JFactory::getCache(),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
$this->assertInstanceOf(
'JCacheControllerCallback',
JFactory::getCache(),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
$this->assertInstanceOf(
'JCacheControllerView',
JFactory::getCache('', 'view', null),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
$this->markTestIncomplete(
- 'This test has not been implemented completely yet.'
+ 'This test has not been implemented completely yet.'
);
}
@@ -187,7 +187,7 @@ function testGetACL()
$this->assertInstanceOf(
'JAccess',
JFactory::getACL(),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
}
@@ -204,7 +204,7 @@ function testGetUri()
$this->assertInstanceOf(
'JUri',
JFactory::getURI('http://www.joomla.org'),
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
}
@@ -223,7 +223,7 @@ function testGetXml()
$this->assertInstanceOf(
'SimpleXMLElement',
$xml,
- 'Line: '.__LINE__
+ 'Line: ' . __LINE__
);
}
View
66 tests/suites/unit/joomla/JPlatformTest.php
@@ -1,39 +1,51 @@
<?php
/**
- * @package Joomla.UnitTest
+ * @package Joomla.UnitTest
*
- * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
*/
-include_once JPATH_PLATFORM.'/platform.php';
+include_once JPATH_PLATFORM . '/platform.php';
/**
* JPlatformTest
*
* Test class for JPlatform.
* Generated by PHPUnit on 2009-10-08 at 21:36:41.
*
- * @package Joomla.UnitTest
- * @subpackage Utilities
+ * @package Joomla.UnitTest
+ * @subpackage Utilities
+ * @since 11.1
*/
class JPlatformTest extends PHPUnit_Framework_TestCase
{
/**
- * @var JPlatform
+ * @var JPlatform
*/
protected $object;
- protected $PRODUCT = 'Joomla!';
- protected $RELEASE = '12.23';
- protected $DEV_STATUS = 'Testing';
- protected $DEV_LEVEL = '999';
- protected $BUILD = '99999';
- protected $CODENAME = 'Desperation';
- protected $RELDATE = '22-June-3109';
- protected $RELTIME = '13:13';
- protected $RELTZ = 'CDT';
- protected $COPYRIGHT = 'Copyright (C) 2005 - 3109 Open Source Matters. All rights reserved.';
- protected $URL = '<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.';
+
+ protected $PRODUCT = 'Joomla!';
+
+ protected $RELEASE = '12.23';
+
+ protected $DEV_STATUS = 'Testing';
+
+ protected $DEV_LEVEL = '999';
+
+ protected $BUILD = '99999';
+
+ protected $CODENAME = 'Desperation';
+
+ protected $RELDATE = '22-June-3109';
+
+ protected $RELTIME = '13:13';
+
+ protected $RELTZ = 'CDT';
+
+ protected $COPYRIGHT = 'Copyright (C) 2005 - 3109 Open Source Matters. All rights reserved.';
+
+ protected $URL = '<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.';
/**
* Sets up the fixture, for example, opens a network connection.
@@ -89,11 +101,11 @@ function casesCompatibility()
false,
'Should not be compatible with null',
),
- 'itself' => array(
- JPlatform::RELEASE.'.'.JPlatform::MAINTENANCE,
+ 'itself' => array(
+ JPlatform::RELEASE . '.' . JPlatform::MAINTENANCE,
true,
- 'Should be compatible with itself',
- ),
+ 'Should be compatible with itself',
+ ),
'version 1.5.22' => array(
'1.5.22',
false,
@@ -111,14 +123,14 @@ function casesCompatibility()
/**
* This checks the compatibility testing method.
*
- * @param string $input Version
- * @param bool $expect expected result of version check
- * @param string $message Test failure message
+ * @param string $input Version
+ * @param bool $expect expected result of version check
+ * @param string $message Test failure message
*
- * @return void
* @dataProvider casesCompatibility
+ * @return void
*/
- public function testIsCompatible( $input, $expect, $message )
+ public function testIsCompatible($input, $expect, $message)
{
$this->assertThat(
$expect,
View
38 tests/suites/unit/joomla/access/JAccessTest.php
@@ -56,12 +56,12 @@ public function testGetAuthorisedViewLevels()
* Test cases for testCheck
*
* Each test case provides
- * - integer userid a user id
- * - integer groupid a group id
- * - string action an action to test permission for
- * - integer assetid id of asset to check
- * - mixed true is have permission, null if no permission
- * - string message if fails
+ * - integer userid a user id
+ * - integer groupid a group id
+ * - string action an action to test permission for
+ * - integer assetid id of asset to check
+ * - mixed true is have permission, null if no permission
+ * - string message if fails
*
* @return array
*
@@ -108,6 +108,8 @@ public function casesCheck()
* @since 11.1
* @dataProvider casesCheck()
* @covers JAccess::check
+ *
+ * @return void
*/
public function testCheck($userId, $action, $assetId, $result, $message)
{
@@ -119,12 +121,12 @@ public function testCheck($userId, $action, $assetId, $result, $message)
* Test cases for testCheckGroups
*
* Each test case provides
- * - integer userid a user id
- * - integer groupid a group id
- * - string action an action to test permission for
- * - integer assetid id of asset to check
- * - mixed true is have permission, null if no permission
- * - string message if fails
+ * - integer userid a user id
+ * - integer groupid a group id
+ * - string action an action to test permission for
+ * - integer assetid id of asset to check
+ * - mixed true is have permission, null if no permission
+ * - string message if fails
*
* @return array
*
@@ -196,6 +198,8 @@ public function testGetAssetRulesValidTrue()
*
* @since 11.1
* @covers JAccess::getAssetRules
+ *
+ * @return void
*/
public function testGetAssetRulesValidFalse()
{
@@ -212,6 +216,8 @@ public function testGetAssetRulesValidFalse()
*
* @since 11.1
* @covers JAccess::getAssetRules
+ *
+ * @return void
*/
public function testGetAssetRulesInvalidFalse()
{
@@ -228,6 +234,8 @@ public function testGetAssetRulesInvalidFalse()
*
* @since 11.1
* @covers JAccess::getAssetRules
+ *
+ * @return void
*/
public function testGetAssetRulesTextFalse()
{
@@ -244,6 +252,8 @@ public function testGetAssetRulesTextFalse()
*
* @since 11.1
* @covers JAccess::getAssetRules
+ *
+ * @return void
*/
public function testGetAssetRulesTextTrue()
{
@@ -275,6 +285,8 @@ public function testGetUsersByGroupSimple()
*
* @since 11.1
* @covers JAccess::getUsersByGroup
+ *
+ * @return void
*/
public function testGetUsersByGroupTwoUsers()
{
@@ -291,6 +303,8 @@ public function testGetUsersByGroupTwoUsers()
*
* @since 11.1
* @covers JAccess::getUsersByGroup
+ *
+ * @return void
*/
public function testGetUsersByGroupInvalidGroup()
{
View
57 tests/suites/unit/joomla/access/JRuleTest.php
@@ -8,7 +8,11 @@
*/
/**
- * @package Joomla.Platform
+ * Test class for JAccessRule.
+ *
+ * @package Joomla.Platform
+ *
+ * @since 11.1
*/
class JAccessRuleTest extends PHPUnit_Framework_TestCase
{
@@ -24,9 +28,9 @@ class JAccessRuleTest extends PHPUnit_Framework_TestCase
public function test__construct()
{
$array = array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
);
// Get the string representation.
@@ -43,19 +47,18 @@ public function test__construct()
// Test constructor with string.
-
// Check that import equals export.
- //**// Check that import equals not export.
+ // Check that import equals not export.
$array_A = array(
- -44 => 1,
- 2 => 1,
- 3 => 0
+ -44 => 1,
+ 2 => 1,
+ 3 => 0
);
$string_A = json_encode($array_A);
- $rule_A = new JAccessRule($string_A);
+ $rule_A = new JAccessRule($string_A);
$this->assertNotEquals(
$string,
(string) $rule_A
@@ -73,9 +76,9 @@ public function test__construct()
public function testGetData()
{
$array = array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
);
$rule = new JAccessRule($array);
@@ -132,9 +135,9 @@ public function testMergeIdentity()
public function testMergeIdentities()
{
$array = array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
);
// Construct an rule with no identities.
@@ -164,18 +167,18 @@ public function testMergeIdentities()
// Merge a new set, flipping some bits.
$array = array(
- -42 => 0,
- 2 => 1,
- 3 => 1,
- 4 => 1
+ -42 => 0,
+ 2 => 1,
+ 3 => 1,
+ 4 => 1
);
// Ident 3 should remain false, 4 should be added.
$result = array(
- -42 => 0,
- 2 => 1,
- 3 => 0,
- 4 => 1
+ -42 => 0,
+ 2 => 1,
+ 3 => 0,
+ 4 => 1
);
$rule->mergeIdentities($array);
$this->assertEquals(
@@ -196,8 +199,8 @@ public function testAllow()
{
// Simple allow and deny test.
$array = array(
- -42 => 0,
- 2 => 1
+ -42 => 0,
+ 2 => 1
);
$rule = new JAccessRule($array);
@@ -206,7 +209,7 @@ public function testAllow()
$rule->allow(-42)
);
- $this->assertEquals(Null, $rule->allow(Null));
+ $this->assertEquals(null, $rule->allow(null));
// This one should be allowed.
$this->assertTrue(
View
162 tests/suites/unit/joomla/access/JRulesTest.php
@@ -8,7 +8,11 @@
*/
/**
- * @package Joomla.Platform
+ * Test class for JAccessRules.
+ *
+ * @package Joomla.Platform
+ *
+ * @since 11.1
*/
class JAccessRulesTest extends PHPUnit_Framework_TestCase
{
@@ -29,9 +33,9 @@ public function test__constructString()
{
$array = array(
'edit' => array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
)
);
@@ -58,9 +62,9 @@ public function testGetData()
{
$array = array(
'edit' => array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
)
);
@@ -80,40 +84,48 @@ public function testGetData()
}
/**
+ * Test...
+ *
* @covers JAccessRules::__construct
* @covers JAccessRules::__toString
+ *
+ * @return void
*/
public function test__constructArray()
- {
- $array = array(
- 'edit' => array(
- -42 => 1,
- 2 => 1,
- 3 => 0
- )
- );
-
- $string = json_encode($array);
-
- $rules = new JAccessRules($array);
- $this->assertThat(
- (string) $rules,
- $this->equalTo($string),
- 'Checks input as an array.'
- );
+ {
+ $array = array(
+ 'edit' => array(
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
+ )
+ );
+
+ $string = json_encode($array);
+
+ $rules = new JAccessRules($array);
+ $this->assertThat(
+ (string) $rules,
+ $this->equalTo($string),
+ 'Checks input as an array.'
+ );
}
/**
+ * Test...
+ *
* @covers JAccessRules::__construct
* @covers JAccessRules::__toString
+ *
+ * @return void
*/
public function test__constructObject()
{
$array = array(
'edit' => array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
)
);
@@ -140,16 +152,16 @@ public function test__constructObject()
public function testMergeRule()
{
$identities = array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
);
$result = array(
'edit' => array(
- -42 => 1,
- 2 => 1,
- 3 => 0
+ -42 => 1,
+ 2 => 1,
+ 3 => 0
)
);
@@ -164,19 +176,19 @@ public function testMergeRule()
// Merge a new set, flipping some bits.
$identities = array(
- -42 => 0,
- 2 => 1,
- 3 => 1,
- 4 => 1
+ -42 => 0,
+ 2 => 1,
+ 3 => 1,
+ 4 => 1
);
// Ident 3 should remain false, 4 should be added.
$result = array(
'edit' => array(
- -42 => 0,
- 2 => 1,
- 3 => 0,
- 4 => 1
+ -42 => 0,
+ 2 => 1,
+ 3 => 0,
+ 4 => 1
)
);
@@ -200,33 +212,33 @@ public function testMerge()
{
$array1 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0
+ -42 => 0
)
);
$string1 = json_encode($array1);
$array2 = array(
'create' => array(
- 2 => 1
+ 2 => 1
),
'delete' => array(
- 2 => 0
+ 2 => 0
)
);
$result2 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0,
- 2 => 0
+ -42 => 0,
+ 2 => 0
),
'create' => array(
- 2 => 1
+ 2 => 1
),
);
@@ -240,16 +252,20 @@ public function testMerge()
}
/**
+ * Test...
+ *
* @covers JAccessRules::merge
+ *
+ * @return void
*/
public function testMergeArray()
{
$array1 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0
+ -42 => 0
)
);
$string1 = json_encode($array1);
@@ -264,16 +280,20 @@ public function testMergeArray()
}
/**
+ * Test...
+ *
* @covers JAccessRules::merge
+ *
+ * @return void
*/
public function testMergeRulesNull()
{
$array1 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0
+ -42 => 0
)
);
$string1 = json_encode($array1);
@@ -290,39 +310,43 @@ public function testMergeRulesNull()
}
/**
+ * Test...
+ *
* @covers JAccessRules::merge
+ *
+ * @return void
*/
public function testMergeRules()
{
$array1 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0
+ -42 => 0
)
);
$string1 = json_encode($array1);
$array2 = array(
'create' => array(
- 2 => 1
+ 2 => 1
),
'delete' => array(
- 2 => 0
+ 2 => 0
)
);
$result2 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0,
- 2 => 0
+ -42 => 0,
+ 2 => 0
),
'create' => array(
- 2 => 1
+ 2 => 1
),
);
@@ -348,11 +372,11 @@ function testAllow()
{
$array1 = array(
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0,
- 2 => 1
+ -42 => 0,
+ 2 => 1
)
);
@@ -406,22 +430,22 @@ function testGetAllowed()
{
$array1 = array(
'create' => array(
- -42 => 1
+ -42 => 1
),
'edit' => array(
- -42 => 1
+ -42 => 1
),
'delete' => array(
- -42 => 0,
- 2 => 1
+ -42 => 0,
+ 2 => 1
)
);
$result = new JObject;
$result->set('create', true);
$result->set('edit', true);
- $rules = new JAccessRules($array1);
+ $rules = new JAccessRules($array1);
$allowed = $rules->getAllowed(-42);
$this->assertThat(
View
33 tests/suites/unit/joomla/application/JApplicationCliTest.php
@@ -7,7 +7,7 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/
-include_once __DIR__.'/stubs/JApplicationCliInspector.php';
+include_once __DIR__ . '/stubs/JApplicationCliInspector.php';
/**
* Test class for JApplicationCli.
@@ -75,7 +75,7 @@ public function test__construct()
// TODO Test that configuration data loaded.
$this->assertGreaterThan(2001, $this->class->get('execution.datetime'), 'Tests execution.datetime was set.');
- $this->assertGreaterThan(1, $this->class->get('execution.timestamp'), 'Tests execution.timestamp was set.' );
+ $this->assertGreaterThan(1, $this->class->get('execution.timestamp'), 'Tests execution.timestamp was set.');
}
/**
@@ -92,24 +92,24 @@ public function test__constructDependancyInjection()
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$mockConfig = $this->getMock('JRegistry', array('test'), array(null), '', true);
$mockConfig
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$mockDispatcher = $this->getMockDispatcher();
$mockDispatcher
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$class = new JApplicationCliInspector($mockInput, $mockConfig, $mockDispatcher);
@@ -186,24 +186,25 @@ public function testExecute()
public function getFetchConfigurationData()
{
return array(
- // file, class, expectsClass, (expected result array), whether there should be an exception
+ // Note: file, class, expectsClass, (expected result array), whether there should be an exception
'Default configuration class' => array(null, null, 'JConfig', 'ConfigEval'),
- 'Custom file, invalid class' => array(JPATH_BASE . '/config.JCli-wrongclass.php', 'noclass', false, array(), true),
+ 'Custom file, invalid class' => array(JPATH_BASE . '/config.JCli-wrongclass.php', 'noclass', false, array(), true),
);
}
/**
* Tests the JApplicationCli::fetchConfigurationData method.
*
- * @param string $fileName The name of the configuration file.
- * @param string $fileName The name of the configuration file.
- * @param boolean $expectsClass The result is expected to be a class.
- * @param array $expects The expected result as an array.
+ * @param string $file The name of the configuration file.
+ * @param string $class The name of the class.
+ * @param boolean $expectsClass The result is expected to be a class.
+ * @param array $expects The expected result as an array.
+ * @param boolean $expectedException The expected exception
*
* @return void
*
* @dataProvider getFetchConfigurationData
- * @since 11.3
+ * @since 11.3
*/
public function testFetchConfigurationData($file, $class, $expectsClass, $expects, $expectedException = false)
{
@@ -228,7 +229,7 @@ public function testFetchConfigurationData($file, $class, $expectsClass, $expect
if ($expects == 'ConfigEval')
{
$expects = new JConfig;
- $expects = (array)$expects;
+ $expects = (array) $expects;
}
if ($expectsClass)
View
109 tests/suites/unit/joomla/application/JApplicationWebTest.php
@@ -61,10 +61,10 @@ public function getDetectRequestUriData()
{
return array(
// HTTPS, PHP_SELF, REQUEST_URI, HTTP_HOST, SCRIPT_NAME, QUERY_STRING, (resulting uri)
- array(null, '/j/index.php', '/j/index.php?foo=bar', 'joom.la:3', '/j/index.php', '', 'http://joom.la:3/j/index.php?foo=bar'),
- array('on', '/j/index.php', '/j/index.php?foo=bar', 'joom.la:3', '/j/index.php', '', 'https://joom.la:3/j/index.php?foo=bar'),
- array(null, '', '', 'joom.la:3', '/j/index.php', '', 'http://joom.la:3/j/index.php'),
- array(null, '', '', 'joom.la:3', '/j/index.php', 'foo=bar', 'http://joom.la:3/j/index.php?foo=bar'),
+ array(null, '/j/index.php', '/j/index.php?foo=bar', 'joom.la:3', '/j/index.php', '', 'http://joom.la:3/j/index.php?foo=bar'),
+ array('on', '/j/index.php', '/j/index.php?foo=bar', 'joom.la:3', '/j/index.php', '', 'https://joom.la:3/j/index.php?foo=bar'),
+ array(null, '', '', 'joom.la:3', '/j/index.php', '', 'http://joom.la:3/j/index.php'),
+ array(null, '', '', 'joom.la:3', '/j/index.php', 'foo=bar', 'http://joom.la:3/j/index.php?foo=bar'),
);
}
@@ -78,7 +78,7 @@ public function getDetectRequestUriData()
public function getRedirectData()
{
return array(
- // url, base, request, (expected result)
+ // Note: url, base, request, (expected result)
array('/foo', 'http://j.org/', 'http://j.org/index.php?v=11.3', 'http://j.org/foo'),
array('foo', 'http://j.org/', 'http://j.org/index.php?v=11.3', 'http://j.org/foo'),
);
@@ -175,7 +175,7 @@ public function test__construct()
$this->assertThat(
$this->class->get('uri.base.host'),
- $this->equalTo('http://'.self::TEST_HTTP_HOST),
+ $this->equalTo('http://' . self::TEST_HTTP_HOST),
'Tests uri base host setting.'
);
}
@@ -194,24 +194,24 @@ public function test__constructDependancyInjection()
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$mockConfig = $this->getMock('JRegistry', array('test'), array(null), '', true);
$mockConfig
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$mockClient = $this->getMock('JApplicationWebClient', array('test'), array(), '', false);
$mockClient
->expects($this->any())
->method('test')
->will(
- $this->returnValue('ok')
- );
+ $this->returnValue('ok')
+ );
$inspector = new JApplicationWebInspector($mockInput, $mockConfig, $mockClient);
@@ -396,10 +396,12 @@ public function testCompressWithGzipEncoding()
// Ensure that the compression headers were set.
$this->assertThat(
TestReflection::getValue($this->class, 'response')->headers,
- $this->equalTo(array(
- 0 => array('name' => 'Content-Encoding', 'value' => 'gzip'),
- 1 => array('name' => 'X-Content-Encoded-By', 'value' => 'Joomla')
- )),
+ $this->equalTo(
+ array(
+ 0 => array('name' => 'Content-Encoding', 'value' => 'gzip'),
+ 1 => array('name' => 'X-Content-Encoded-By', 'value' => 'Joomla')
+ )
+ ),
'Checks the headers were set correctly.'
);
}
@@ -450,10 +452,12 @@ public function testCompressWithDeflateEncoding()
// Ensure that the compression headers were set.
$this->assertThat(
TestReflection::getValue($this->class, 'response')->headers,
- $this->equalTo(array(
- 0 => array('name' => 'Content-Encoding', 'value' => 'deflate'),
- 1 => array('name' => 'X-Content-Encoded-By', 'value' => 'Joomla')
- )),
+ $this->equalTo(
+ array(
+ 0 => array('name' => 'Content-Encoding', 'value' => 'deflate'),
+ 1 => array('name' => 'X-Content-Encoded-By', 'value' => 'Joomla')
+ )
+ ),
'Checks the headers were set correctly.'
);
}
@@ -557,6 +561,7 @@ public function testCompressWithHeadersSent()
$this->equalTo(471),
'Checks the compressed output is the same as the uncompressed output -- no compression.'
);
+
// Ensure that the compression headers were not set.
$this->assertThat(
TestReflection::getValue($this->class, 'response')->headers,
@@ -619,6 +624,14 @@ public function testCompressWithUnsupportedEncodings()
/**
* Tests the JApplicationWeb::detectRequestUri method.
*
+ * @param string $https @todo
+ * @param string $phpSelf @todo
+ * @param string $requestUri @todo
+ * @param string $httpHost @todo
+ * @param string $scriptName @todo
+ * @param string $queryString @todo
+ * @param string $expects @todo
+ *
* @return void
*
* @dataProvider getDetectRequestUriData
@@ -751,24 +764,25 @@ public function testExecuteWithDocument()
public function getFetchConfigurationData()
{
return array(
- // file, class, expectsClass, (expected result array), whether there should be an exception
+ // Note: file, class, expectsClass, (expected result array), whether there should be an exception
'Default configuration class' => array(null, null, 'JConfig', 'ConfigEval'),
- 'Custom file, invalid class' => array(JPATH_BASE . '/config.JCli-wrongclass.php', 'noclass', false, array(), true),
+ 'Custom file, invalid class' => array(JPATH_BASE . '/config.JCli-wrongclass.php', 'noclass', false, array(), true),
);
}
/**
* Tests the JCli::fetchConfigurationData method.
*
- * @param string $fileName The name of the configuration file.
- * @param string $fileName The name of the configuration file.
- * @param boolean $expectsClass The result is expected to be a class.
- * @param array $expects The expected result as an array.
+ * @param string $file The name of the configuration file.
+ * @param string $class The name of the class.
+ * @param boolean $expectsClass The result is expected to be a class.
+ * @param array $expects The expected result as an array.
+ * @param bool $expectedException The expected exception.
*
* @return void
*
* @dataProvider getFetchConfigurationData
- * @since 11.3
+ * @since 11.3
*/
public function testFetchConfigurationData($file, $class, $expectsClass, $expects, $expectedException = false)
{
@@ -793,7 +807,7 @@ public function testFetchConfigurationData($file, $class, $expectsClass, $expect
if ($expects == 'ConfigEval')
{
$expects = new JConfig;
- $expects = (array)$expects;
+ $expects = (array) $expects;
}
if ($expectsClass)
@@ -1012,32 +1026,32 @@ public function testInitialiseWithInjection()
->expects($this->any())
->method('test')
->will(
- $this->returnValue('JSession')
- );
+ $this->returnValue('JSession')
+ );
$mockDocument = $this->getMock('JDocument', array('test'), array(), '', false);
$mockDocument
->expects($this->any())
->method('test')
->will(
- $this->returnValue('JDocument')
- );
+ $this->returnValue('JDocument')
+ );
$mockLanguage = $this->getMock('JLanguage', array('test'), array(), '', false);
$mockLanguage
->expects($this->any())
->method('test')
->will(
- $this->returnValue('JLanguage')
- );
+ $this->returnValue('JLanguage')
+ );
$mockDispatcher = $this->getMock('JEventDispatcher', array('test'), array(), '', false);
$mockDispatcher
->expects($this->any())
->method('test')
->will(
- $this->returnValue('JEventDispatcher')
- );
+ $this->returnValue('JEventDispatcher')
+ );
$this->class->initialise($mockSession, $mockDocument, $mockLanguage, $mockDispatcher);
@@ -1416,7 +1430,7 @@ public function testRedirect()
$this->equalTo(
array(
array('HTTP/1.1 303 See other', true, null),
- array('Location: '.$base.$url, true, null),
+ array('Location: ' . $base . $url, true, null),
array('Content-Type: text/html; charset=utf-8', true, null),
)
)
@@ -1485,10 +1499,10 @@ public function testRedirectWithJavascriptRedirect()
$this->assertThat(
trim($buffer),
$this->equalTo(
- '<html><head>' .
- '<meta http-equiv="content-type" content="text/html; charset=utf-8" />' .
- "<script>document.location.href='{$url}';</script>" .
- '</head><body></body></html>'
+ '<html><head>'
+ . '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'
+ . "<script>document.location.href='{$url}';</script>"
+ . '</head><body></body></html>'
)
);
}
@@ -1520,7 +1534,7 @@ public function testRedirectWithMoved()
$this->equalTo(
array(
array('HTTP/1.1 301 Moved Permanently', true, null),
- array('Location: '.$url, true, null),
+ array('Location: ' . $url, true, null),
array('Content-Type: text/html; charset=utf-8', true, null),
)
)
@@ -1530,6 +1544,11 @@ public function testRedirectWithMoved()
/**
* Tests the JApplicationWeb::redirect method with assorted URL's.
*
+ * @param string $url @todo
+ * @param string $base @todo
+ * @param string $request @todo
+ * @param string $expected @todo
+ *
* @return void
*
* @dataProvider getRedirectData
@@ -1557,7 +1576,7 @@ public function testRedirectWithUrl($url, $base, $request, $expected)
$this->assertThat(
$this->class->headers[1][0],
- $this->equalTo('Location: '.$expected)
+ $this->equalTo('Location: ' . $expected)
);
}
@@ -1758,7 +1777,11 @@ public function testSetHeader()
}
/**
+ * Test...
+ *
* @covers JApplicationWeb::isSSLConnection
+ *
+ * @return void
*/
public function testIsSSLConnection()
{
View
178 tests/suites/unit/joomla/application/JRouterTest.php
@@ -12,6 +12,10 @@
/**
* Test class for JRouter.
* Generated by PHPUnit on 2009-10-08 at 12:50:42.
+ *
+ * @package Joomla.UnitTest
+ *
+ * @since 11.1
*/
class JRouterTest extends PHPUnit_Framework_TestCase
{
@@ -20,14 +24,20 @@ class JRouterTest extends PHPUnit_Framework_TestCase
* This method is called before a test is executed.
*
* @access protected
+ *
+ * @return void
*/
protected function setUp()
{
$this->object = new JRouter;
}
/**
+ * Test...
+ *
* @todo Implement testGetInstance().
+ *
+ * @return void
*/
public function testGetInstance()
{
@@ -36,7 +46,11 @@ public function testGetInstance()
}
/**
+ * Test...
+ *
* @todo Implement testParse().
+ *
+ * @return void
*/
public function testParse()
{
@@ -45,7 +59,11 @@ public function testParse()
}
/**
+ * Test...
+ *
* @todo Implement testBuild().
+ *
+ * @return void
*/
public function testBuild()
{
@@ -54,7 +72,11 @@ public function testBuild()
}
/**
+ * Test...
+ *
* @todo Implement testGetMode().
+ *
+ * @return void
*/
public function testGetMode()
{
@@ -63,7 +85,11 @@ public function testGetMode()
}
/**
+ * Test...
+ *
* @todo Implement testSetMode().
+ *
+ * @return void
*/
public function testSetMode()
{
@@ -73,30 +99,45 @@ public function testSetMode()
/**
* Cases for testSetVar
+ *
+ * @return array
*/
public function casesSetVar()
{
$cases = array();
$cases[] = array(array(), 'myvar', 'myvalue', true, 'myvalue');
$cases[] = array(array(), 'myvar', 'myvalue', false, null);
- $cases[] = array(array('myvar'=>'myvalue1'), 'myvar', 'myvalue2', true, 'myvalue2');
- $cases[] = array(array('myvar'=>'myvalue1'), 'myvar', 'myvalue2', false, 'myvalue2');
+ $cases[] = array(array('myvar' => 'myvalue1'), 'myvar', 'myvalue2', true, 'myvalue2');
+ $cases[] = array(array('myvar' => 'myvalue1'), 'myvar', 'myvalue2', false, 'myvalue2');
return $cases;
}
- /**
- * testAttributes()
- *
- * @dataProvider casesSetVar
- */
- public function testSetVar($vars, $var, $value, $create, $expected) {
+ /**
+ * testAttributes()
+ *
+ * @param array $vars @todo
+ * @param string $var @todo
+ * @param mixed $value @todo
+ * @param boolean $create @todo
+ * @param string $expected @todo
+ *
+ * @dataProvider casesSetVar
+ *
+ * @return void
+ */
+ public function testSetVar($vars, $var, $value, $create, $expected)
+ {
$this->object->setVars($vars, false);
$this->object->setVar($var, $value, $create);
$this->assertEquals($this->object->getVar($var), $expected, __METHOD__ . ':' . __LINE__ . ': value is not expected');
}
/**
+ * Test...
+ *
* @todo Implement testSetVars().
+ *
+ * @return void
*/
public function testSetVars()
{
@@ -105,7 +146,11 @@ public function testSetVars()
}
/**
+ * Test...
+ *
* @todo Implement testGetVar().
+ *
+ * @return void
*/
public function testGetVar()
{
@@ -114,7 +159,11 @@ public function testGetVar()
}
/**
+ * Test...
+ *
* @todo Implement testGetVars().
+ *
+ * @return void
*/
public function testGetVars()
{
@@ -123,7 +172,11 @@ public function testGetVars()
}
/**
+ * Test...
+ *
* @todo Implement testAttachBuildRule().
+ *
+ * @return void
*/
public function testAttachBuildRule()
{
@@ -132,7 +185,11 @@ public function testAttachBuildRule()
}
/**
+ * Test...
+ *
* @todo Implement testAttachParseRule().
+ *
+ * @return void
*/
public function testAttachParseRule()
{
@@ -141,15 +198,24 @@ public function testAttachParseRule()
}
/**
+ * Test...
+ *
* @todo Implement test_parseRawRoute().
+ *
+ * @return void
*/
- public function test_parseRawRoute() {
+ public function test_parseRawRoute()
+ {
// Remove the following lines when you implement this test.
$this->markTestIncomplete('This test has not been implemented yet.');
}
/**
+ * Test...
+ *
* @todo Implement test_parseSefRoute().
+ *
+ * @return void
*/
public function test_parseSefRoute()
{
@@ -158,7 +224,11 @@ public function test_parseSefRoute()
}
/**
+ * Test...
+ *
* @todo Implement test_buildRawRoute().
+ *
+ * @return void
*/
public function test_buildRawRoute()
{
@@ -167,7 +237,11 @@ public function test_buildRawRoute()
}
/**
+ * Test...
+ *
* @todo Implement test_buildSefRoute().
+ *
+ * @return void
*/
public function test_buildSefRoute()
{
@@ -177,49 +251,71 @@ public function test_buildSefRoute()
/**
* Cases for test_processParseRules
+ *
+ * @return array
*/
public function cases_processParseRules()
{
$cases = array();
$cases[] = array(array(), array());
- $cases[] =
+ $cases[] = array(
array(
- array(
- function(&$router, &$uri) {return array('myvar'=>'myvalue');}
- ),
- array('myvar'=>'myvalue')
- );
- $cases[] =
+ function (&$router, &$uri)
+ {
+ return array('myvar' => 'myvalue');
+ }
+ ),
+ array('myvar' => 'myvalue')
+ );
+ $cases[] = array(
array(
- array(
- function(&$router, &$uri) {return array('myvar1'=>'myvalue1');},
- function(&$router, &$uri) {return array('myvar2'=>'myvalue2');},
- ),
- array('myvar1'=>'myvalue1', 'myvar2'=>'myvalue2')
- );
- $cases[] =
+ function (&$router, &$uri)
+ {
+ return array('myvar1' => 'myvalue1');
+ },
+ function (&$router, &$uri)
+ {
+ return array('myvar2' => 'myvalue2');
+ },
+ ),
+ array('myvar1' => 'myvalue1', 'myvar2' => 'myvalue2')
+ );
+ $cases[] = array(
array(
- array(
- function(&$router, &$uri) {return array('myvar1'=>'myvalue1');},
- function(&$router, &$uri) {return array('myvar2'=>'myvalue2');},
- function(&$router, &$uri) {return array('myvar1'=>'myvalue3');},
- ),
- array('myvar1'=>'myvalue1', 'myvar2'=>'myvalue2')
- );
+ function (&$router, &$uri)
+ {
+ return array('myvar1' => 'myvalue1');
+ },
+ function (&$router, &$uri)
+ {
+ return array('myvar2' => 'myvalue2');
+ },
+ function (&$router, &$uri)
+ {
+ return array('myvar1' => 'myvalue3');
+ },
+ ),
+ array('myvar1' => 'myvalue1', 'myvar2' => 'myvalue2')
+ );
return $cases;
}
/**
* test_processParseRules().
- *
- * @dataProvider cases_processParseRules
+ *
+ * @param array $functions @todo
+ * @param string $expected @todo
+ *
+ * @dataProvider cases_processParseRules
+ *
+ * @return void
*/
public function test_processParseRules($functions, $expected)
{
$myuri = 'http://localhost';
$stub = $this->getMock('JRouter', array('_parseRawRoute'));
- $stub->expects($this->any())->method('_parseRawRoute')->will($this->returnValue(array()));
+ $stub->expects($this->any())->method('_parseRawRoute')->will($this->returnValue(array()));
foreach ($functions as $function)
{
$stub->attachParseRule($function);
@@ -228,7 +324,11 @@ public function test_processParseRules($functions, $expected)
}
/**
+ * Test...
+ *
* @todo Implement test_processBuildRules().
+ *
+ * @return void
*/
public function test_processBuildRules()
{
@@ -237,7 +337,11 @@ public function test_processBuildRules()
}
/**
+ * Test...
+ *
* @todo Implement test_createURI().
+ *
+ * @return void
*/
public function test_createURI()
{
@@ -246,7 +350,11 @@ public function test_createURI()
}
/**
+ * Test...
+ *
* @todo Implement test_encodeSegments().
+ *
+ * @return void
*/
public function test_encodeSegments()
{
@@ -255,7 +363,11 @@ public function test_encodeSegments()
}
/**
+ * Test...
+ *
* @todo Implement test_decodeSegments().
+ *
+ * @return void
*/
public function test_decodeSegments()
{
View