Skip to content
Permalink
Browse files

Various improvements to the CakePHP test files

Mostly CS, doc blocks and unused variables.
  • Loading branch information...
ravage84 committed Sep 25, 2015
1 parent c14d1ff commit 1ede742d926e3b8a060fcfb1a6dda2eb3e5c10c7
Showing with 94 additions and 119 deletions.
  1. +5 −5 lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
  2. +0 −1 lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  3. +4 −0 lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php
  4. +1 −2 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
  5. +2 −2 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
  6. +1 −1 lib/Cake/Test/Case/Controller/ControllerTest.php
  7. +0 −1 lib/Cake/Test/Case/Core/CakePluginTest.php
  8. +3 −0 lib/Cake/Test/Case/Core/ConfigureTest.php
  9. +5 −4 lib/Cake/Test/Case/Core/ObjectTest.php
  10. +0 −1 lib/Cake/Test/Case/Event/CakeEventManagerTest.php
  11. +0 −1 lib/Cake/Test/Case/Event/CakeEventTest.php
  12. +1 −2 lib/Cake/Test/Case/Model/AclNodeTest.php
  13. +0 −1 lib/Cake/Test/Case/Model/models.php
  14. +1 −7 lib/Cake/Test/Case/Network/CakeRequestTest.php
  15. +4 −4 lib/Cake/Test/Case/Network/CakeResponseTest.php
  16. +4 −9 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  17. +0 −1 lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
  18. +0 −1 lib/Cake/Test/Case/Network/Email/MailTransportTest.php
  19. +4 −6 lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
  20. +6 −8 lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
  21. +0 −1 lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php
  22. +10 −10 lib/Cake/Test/Case/Routing/Route/RedirectRouteTest.php
  23. +3 −3 lib/Cake/Test/Case/Routing/RouterTest.php
  24. +7 −7 lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php
  25. +1 −1 lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
  26. +4 −4 lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
  27. +1 −1 lib/Cake/Test/Case/Utility/FolderTest.php
  28. +2 −2 lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
  29. +1 −1 lib/Cake/Test/Case/Utility/SanitizeTest.php
  30. +1 −1 lib/Cake/Test/Case/Utility/SecurityTest.php
  31. +0 −1 lib/Cake/Test/Case/Utility/SetTest.php
  32. +1 −1 lib/Cake/Test/Case/Utility/ValidationTest.php
  33. +3 −3 lib/Cake/Test/Case/Utility/XmlTest.php
  34. +0 −1 lib/Cake/Test/bake_compare/Controller/Scaffold.ctp
  35. +0 −1 lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php
  36. +0 −1 lib/Cake/Test/test_app/Plugin/TestPlugin/View/Errors/error500.ctp
  37. +1 −2 lib/Cake/Test/test_app/View/Elements/html_call.ctp
  38. +1 −2 lib/Cake/Test/test_app/View/Emails/html/default.ctp
  39. +2 −1 lib/Cake/Test/test_app/View/Layouts/ajax2.ctp
  40. +1 −3 lib/Cake/Test/test_app/View/Layouts/rss/default.ctp
  41. +1 −2 lib/Cake/Test/test_app/View/Posts/helper_overwrite.ctp
  42. +1 −1 lib/Cake/Test/test_app/View/Posts/parent_view.ctp
  43. +1 −1 lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp
  44. +1 −1 lib/Cake/Test/test_app/View/Themed/TestTheme/Emails/text/themed.ctp
  45. +1 −1 lib/Cake/Test/test_app/View/Themed/TestTheme/Layouts/default.ctp
  46. +2 −2 lib/Cake/TestSuite/CakeTestCase.php
  47. +3 −3 lib/Cake/TestSuite/CakeTestLoader.php
  48. +1 −1 lib/Cake/TestSuite/ControllerTestCase.php
  49. +2 −2 lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
  50. +1 −1 lib/Cake/TestSuite/templates/header.php
@@ -37,7 +37,7 @@ public function testDescription() {
$this->assertEquals($parser, $result, 'Setting description is not chainable');
$this->assertEquals('A test', $parser->description(), 'getting value is wrong.');
$result = $parser->description(array('A test', 'something'));
$parser->description(array('A test', 'something'));
$this->assertEquals("A test\nsomething", $parser->description(), 'getting value is wrong.');
}
@@ -53,7 +53,7 @@ public function testEpilog() {
$this->assertEquals($parser, $result, 'Setting epilog is not chainable');
$this->assertEquals('A test', $parser->epilog(), 'getting value is wrong.');
$result = $parser->epilog(array('A test', 'something'));
$parser->epilog(array('A test', 'something'));
$this->assertEquals("A test\nsomething", $parser->epilog(), 'getting value is wrong.');
}
@@ -294,7 +294,7 @@ public function testOptionWithChoices() {
$expected = array('name' => 'mark', 'help' => false);
$this->assertEquals($expected, $result[0], 'Got the correct value.');
$result = $parser->parse(array('--name', 'jimmy'));
$parser->parse(array('--name', 'jimmy'));
}
/**
@@ -384,7 +384,7 @@ public function testParseArgumentTooMany() {
$result = $parser->parse($expected);
$this->assertEquals($expected, $result[1], 'Arguments are not as expected');
$result = $parser->parse(array('one', 'two', 'three'));
$parser->parse(array('one', 'two', 'three'));
}
/**
@@ -430,7 +430,7 @@ public function testPositionalArgWithChoices() {
$expected = array('mark', 'samurai', 'sword');
$this->assertEquals($expected, $result[1], 'Got the correct value.');
$result = $parser->parse(array('jose', 'coder'));
$parser->parse(array('jose', 'coder'));
}
/**
@@ -155,7 +155,6 @@ class DbAclTwoTest extends DbAcl {
/**
* construct method
*
*/
public function __construct() {
$this->Aro = new AroTwoTest();
@@ -45,6 +45,8 @@ public function setUp() {
}
/**
* testControllerTypeError
*
* @expectedException PHPUnit_Framework_Error
* @return void
*/
@@ -53,6 +55,8 @@ public function testControllerTypeError() {
}
/**
* testControllerErrorOnMissingMethod
*
* @expectedException CakeException
* @return void
*/
@@ -176,7 +176,6 @@ class AuthTestController extends Controller {
/**
* construct method
*
*/
public function __construct($request, $response) {
$request->addParams(Router::parse('/auth_test'));
@@ -1319,7 +1318,7 @@ public function testAjaxLoginResponseCodeNoElement() {
->with('HTTP/1.1 403 Forbidden', null);
$this->Auth->initialize($this->Controller);
$result = $this->Auth->startup($this->Controller);
$this->Auth->startup($this->Controller);
$this->assertArrayNotHasKey('Location', $this->Controller->response->header());
$this->assertNull($this->Controller->testUrl, 'redirect() not called');
@@ -486,7 +486,7 @@ public function testPaginateExtraParams() {
$Controller->request->params['named'] = array('limit' => 12);
$Controller->Paginator->settings = array('limit' => 30, 'maxLimit' => 100, 'paramType' => 'named');
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$Controller->Paginator->paginate('PaginatorControllerPost');
$paging = $Controller->params['paging']['PaginatorControllerPost'];
$this->assertEquals(12, $Controller->PaginatorControllerPost->lastQueries[0]['limit']);
@@ -504,7 +504,7 @@ public function testPaginateExtraParams() {
'paramType' => 'named'
)
);
$result = $Controller->Paginator->paginate('ControllerPaginateModel');
$Controller->Paginator->paginate('ControllerPaginateModel');
$expected = array(
'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',
@@ -653,7 +653,7 @@ public function testRender() {
$expected = $Controller->ControllerComment->validationErrors;
$Controller->viewPath = 'Posts';
$result = $Controller->render('index');
$Controller->render('index');
$View = $Controller->View;
$this->assertTrue(isset($View->validationErrors['ControllerComment']));
$this->assertEquals($expected, $View->validationErrors['ControllerComment']);
@@ -20,7 +20,6 @@
/**
* CakePluginTest class
*
*/
class CakePluginTest extends CakeTestCase {
@@ -69,6 +69,7 @@ public function tearDown() {
/**
* Test to ensure bootrapping doesn't overwrite prior configs set under 'App' key
*
* @return void
*/
public function testBootstrap() {
@@ -469,6 +470,8 @@ public function testClear() {
}
/**
* testDumpNoAdapter
*
* @expectedException ConfigureException
* @return void
*/
@@ -73,7 +73,7 @@ public function another_ra_test($id, $other) {
/**
* normal_request_action method
*
* @return void
* @return string Hello World!
*/
public function normal_request_action() {
return 'Hello World';
@@ -82,7 +82,7 @@ public function normal_request_action() {
/**
* returns $this->here
*
* @return void
* @return string $this->here.
*/
public function return_here() {
return $this->here;
@@ -91,7 +91,7 @@ public function return_here() {
/**
* paginate_request_action method
*
* @return void
* @return true
*/
public function paginate_request_action() {
$this->paginate();
@@ -251,8 +251,9 @@ public function methodWithOptionalParam($param = null) {
}
/**
* undocumented function
* Set properties.
*
* @param array $properties The $properties.
* @return void
*/
public function set($properties = array()) {
@@ -88,7 +88,6 @@ public function thirdListenerFunction() {
/**
* Tests the CakeEventManager class functionality
*
*/
class CakeEventManagerTest extends CakeTestCase {
@@ -22,7 +22,6 @@
/**
* Tests the CakeEvent class functionality
*
*/
class CakeEventTest extends CakeTestCase {
@@ -181,8 +181,7 @@ public function bindNode($ref = null) {
class TestDbAcl extends DbAcl {
/**
* construct method
*
* Constructor
*/
public function __construct() {
$this->Aro = new DbAroTest();
@@ -4781,7 +4781,6 @@ public function schema($field = false) {
/**
* Test model for datasource prefixes
*
*/
class PrefixTestModel extends CakeTestModel {
}
@@ -318,12 +318,6 @@ public function testPutParsing() {
$request->reConstruct();
$this->assertEquals($data, $request->data);
$data = array(
'data' => array(
'Article' => array('title' => 'Testing'),
),
'action' => 'update'
);
$request = $this->getMock('TestCakeRequest', array('_readInput'));
$request->expects($this->at(0))->method('_readInput')
->will($this->returnValue('data[Article][title]=Testing&action=update'));
@@ -2261,7 +2255,7 @@ public function testAcceptLanguage() {
// Checking if requested
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx,en_ca';
$result = CakeRequest::acceptLanguage();
CakeRequest::acceptLanguage();
$result = CakeRequest::acceptLanguage('en-ca');
$this->assertTrue($result);
@@ -566,7 +566,7 @@ public function testSendContentLength() {
$response->send();
ob_start();
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
$this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
$goofyOutput = 'I am goofily sending output in the controller';
echo $goofyOutput;
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
@@ -1746,7 +1746,7 @@ public function testFileRangeInvalid() {
);
$this->assertEquals(416, $response->statusCode());
$result = $response->send();
$response->send();
}
/**
@@ -1787,7 +1787,7 @@ public function testFileRangeOffsetsNoDownload($range, $length, $offsetResponse)
);
ob_start();
$result = $response->send();
$response->send();
ob_get_clean();
}
@@ -1876,7 +1876,7 @@ public function testFileRangeInvalidNoDownload() {
);
$this->assertEquals(416, $response->statusCode());
$result = $response->send();
$response->send();
}
/**
@@ -21,7 +21,6 @@
/**
* Help to test CakeEmail
*
*/
class TestCakeEmail extends CakeEmail {
@@ -36,7 +35,6 @@ class TestCakeEmail extends CakeEmail {
/**
* Config
*
*/
protected $_config = array();
@@ -89,7 +87,6 @@ public function render($content) {
/**
* EmailConfig class
*
*/
class TestEmailConfig {
@@ -135,7 +132,6 @@ class TestEmailConfig {
/**
* ExtendTransport class
* test class to ensure the class has send() method
*
*/
class ExtendTransport {
@@ -217,7 +213,7 @@ public function testFrom() {
$this->assertSame($this->CakeEmail, $result);
$this->setExpectedException('SocketException');
$result = $this->CakeEmail->from(array('cake@cakephp.org' => 'CakePHP', 'fail@cakephp.org' => 'From can only be one address'));
$this->CakeEmail->from(array('cake@cakephp.org' => 'CakePHP', 'fail@cakephp.org' => 'From can only be one address'));
}
/**
@@ -866,7 +862,7 @@ public function testTransport() {
$this->setExpectedException('SocketException');
$this->CakeEmail->transport('Invalid');
$result = $this->CakeEmail->transportClass();
$this->CakeEmail->transportClass();
}
/**
@@ -955,7 +951,7 @@ public function testConfigMerge() {
$this->assertEquals($expected, $this->CakeEmail->transportClass()->config());
$this->CakeEmail->config(array('log' => true));
$result = $this->CakeEmail->transportClass()->config();
$this->CakeEmail->transportClass()->config();
$expected += array('log' => true);
$this->assertEquals($expected, $this->CakeEmail->transportClass()->config());
@@ -2028,7 +2024,7 @@ public function testEmailFormat() {
$this->assertEquals('html', $result);
$this->setExpectedException('SocketException');
$result = $this->CakeEmail->emailFormat('invalid');
$this->CakeEmail->emailFormat('invalid');
}
/**
@@ -2385,7 +2381,6 @@ public function testWrapWithTagsAcrossLines() {
style="font-weight: bold">The tag is across multiple lines</th>
</table>
HTML;
$length = strlen($str);
$message = $str . str_repeat('x', CakeEmail::LINE_LENGTH_MUST + 1);
$this->CakeEmail->reset();
@@ -22,7 +22,6 @@
/**
* Test case
*
*/
class DebugTransportTest extends CakeTestCase {
@@ -22,7 +22,6 @@
/**
* Test case
*
*/
class MailTransportTest extends CakeTestCase {
Oops, something went wrong.

0 comments on commit 1ede742

Please sign in to comment.
You can’t perform that action at this time.