Various improvements to the CakePHP test files

Mostly CS, doc blocks and unused variables.
This commit is contained in:
Marc Würth 2015-09-25 17:22:00 +02:00
parent c14d1ffe93
commit 1ede742d92
50 changed files with 94 additions and 119 deletions

View file

@ -37,7 +37,7 @@ class ConsoleOptionParserTest extends CakeTestCase {
$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 @@ class ConsoleOptionParserTest extends CakeTestCase {
$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 @@ class ConsoleOptionParserTest extends CakeTestCase {
$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 @@ class ConsoleOptionParserTest extends CakeTestCase {
$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 @@ class ConsoleOptionParserTest extends CakeTestCase {
$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'));
}
/**

View file

@ -155,7 +155,6 @@ class DbAclTwoTest extends DbAcl {
/**
* construct method
*
*/
public function __construct() {
$this->Aro = new AroTwoTest();

View file

@ -45,6 +45,8 @@ class ControllerAuthorizeTest extends CakeTestCase {
}
/**
* testControllerTypeError
*
* @expectedException PHPUnit_Framework_Error
* @return void
*/
@ -53,6 +55,8 @@ class ControllerAuthorizeTest extends CakeTestCase {
}
/**
* testControllerErrorOnMissingMethod
*
* @expectedException CakeException
* @return void
*/

View file

@ -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 @@ class AuthComponentTest extends CakeTestCase {
->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');

View file

@ -486,7 +486,7 @@ class PaginatorComponentTest extends CakeTestCase {
$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 @@ class PaginatorComponentTest extends CakeTestCase {
'paramType' => 'named'
)
);
$result = $Controller->Paginator->paginate('ControllerPaginateModel');
$Controller->Paginator->paginate('ControllerPaginateModel');
$expected = array(
'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',

View file

@ -653,7 +653,7 @@ class ControllerTest extends CakeTestCase {
$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']);

View file

@ -20,7 +20,6 @@ App::uses('CakePlugin', 'Core');
/**
* CakePluginTest class
*
*/
class CakePluginTest extends CakeTestCase {

View file

@ -69,6 +69,7 @@ class ConfigureTest extends CakeTestCase {
/**
* Test to ensure bootrapping doesn't overwrite prior configs set under 'App' key
*
* @return void
*/
public function testBootstrap() {
@ -469,6 +470,8 @@ class ConfigureTest extends CakeTestCase {
}
/**
* testDumpNoAdapter
*
* @expectedException ConfigureException
* @return void
*/

View file

@ -73,7 +73,7 @@ class RequestActionController extends Controller {
/**
* normal_request_action method
*
* @return void
* @return string Hello World!
*/
public function normal_request_action() {
return 'Hello World';
@ -82,7 +82,7 @@ class RequestActionController extends Controller {
/**
* returns $this->here
*
* @return void
* @return string $this->here.
*/
public function return_here() {
return $this->here;
@ -91,7 +91,7 @@ class RequestActionController extends Controller {
/**
* paginate_request_action method
*
* @return void
* @return true
*/
public function paginate_request_action() {
$this->paginate();
@ -251,8 +251,9 @@ class TestObject extends Object {
}
/**
* undocumented function
* Set properties.
*
* @param array $properties The $properties.
* @return void
*/
public function set($properties = array()) {

View file

@ -88,7 +88,6 @@ class CustomTestEventListener extends CakeEventTestListener implements CakeEvent
/**
* Tests the CakeEventManager class functionality
*
*/
class CakeEventManagerTest extends CakeTestCase {

View file

@ -22,7 +22,6 @@ App::uses('CakeEvent', 'Event');
/**
* Tests the CakeEvent class functionality
*
*/
class CakeEventTest extends CakeTestCase {

View file

@ -181,8 +181,7 @@ class DbAroUserTest extends CakeTestModel {
class TestDbAcl extends DbAcl {
/**
* construct method
*
* Constructor
*/
public function __construct() {
$this->Aro = new DbAroTest();

View file

@ -4781,7 +4781,6 @@ class MysqlTestModel extends Model {
/**
* Test model for datasource prefixes
*
*/
class PrefixTestModel extends CakeTestModel {
}

View file

@ -318,12 +318,6 @@ class CakeRequestTest extends CakeTestCase {
$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 @@ class CakeRequestTest extends CakeTestCase {
// Checking if requested
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx,en_ca';
$result = CakeRequest::acceptLanguage();
CakeRequest::acceptLanguage();
$result = CakeRequest::acceptLanguage('en-ca');
$this->assertTrue($result);

View file

@ -566,7 +566,7 @@ class CakeResponseTest extends CakeTestCase {
$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 @@ class CakeResponseTest extends CakeTestCase {
);
$this->assertEquals(416, $response->statusCode());
$result = $response->send();
$response->send();
}
/**
@ -1787,7 +1787,7 @@ class CakeResponseTest extends CakeTestCase {
);
ob_start();
$result = $response->send();
$response->send();
ob_get_clean();
}
@ -1876,7 +1876,7 @@ class CakeResponseTest extends CakeTestCase {
);
$this->assertEquals(416, $response->statusCode());
$result = $response->send();
$response->send();
}
/**

View file

@ -21,7 +21,6 @@ App::uses('File', 'Utility');
/**
* Help to test CakeEmail
*
*/
class TestCakeEmail extends CakeEmail {
@ -36,7 +35,6 @@ class TestCakeEmail extends CakeEmail {
/**
* Config
*
*/
protected $_config = array();
@ -89,7 +87,6 @@ class TestCakeEmail extends CakeEmail {
/**
* 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 @@ class CakeEmailTest extends CakeTestCase {
$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 @@ class CakeEmailTest extends CakeTestCase {
$this->setExpectedException('SocketException');
$this->CakeEmail->transport('Invalid');
$result = $this->CakeEmail->transportClass();
$this->CakeEmail->transportClass();
}
/**
@ -955,7 +951,7 @@ class CakeEmailTest extends CakeTestCase {
$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 @@ class CakeEmailTest extends CakeTestCase {
$this->assertEquals('html', $result);
$this->setExpectedException('SocketException');
$result = $this->CakeEmail->emailFormat('invalid');
$this->CakeEmail->emailFormat('invalid');
}
/**
@ -2385,7 +2381,6 @@ class CakeEmailTest extends CakeTestCase {
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();

View file

@ -22,7 +22,6 @@ App::uses('DebugTransport', 'Network/Email');
/**
* Test case
*
*/
class DebugTransportTest extends CakeTestCase {

View file

@ -22,7 +22,6 @@ App::uses('MailTransport', 'Network/Email');
/**
* Test case
*
*/
class MailTransportTest extends CakeTestCase {

View file

@ -22,14 +22,13 @@ App::uses('SmtpTransport', 'Network/Email');
/**
* Help to test SmtpTransport
*
*/
class SmtpTestTransport extends SmtpTransport {
/**
* Helper to change the socket
*
* @param object $socket
* @param CakeSocket $socket A socket.
* @return void
*/
public function setSocket(CakeSocket $socket) {
@ -39,7 +38,7 @@ class SmtpTestTransport extends SmtpTransport {
/**
* Helper to change the CakeEmail
*
* @param object $cakeEmail
* @param object $cakeEmail An email object.
* @return void
*/
public function setCakeEmail($cakeEmail) {
@ -57,8 +56,8 @@ class SmtpTestTransport extends SmtpTransport {
/**
* Magic function to call protected methods
*
* @param string $method
* @param string $args
* @param string $method The method to call.
* @param string $args The arguments.
* @return mixed
*/
public function __call($method, $args) {
@ -70,7 +69,6 @@ class SmtpTestTransport extends SmtpTransport {
/**
* Test case
*
*/
class SmtpTransportTest extends CakeTestCase {

View file

@ -29,8 +29,8 @@ class TestAuthentication {
/**
* authentication method
*
* @param HttpSocket $http
* @param array $authInfo
* @param HttpSocket $http A HTTP socket.
* @param array &$authInfo Some auth info.
* @return void
*/
public static function authentication(HttpSocket $http, &$authInfo) {
@ -40,8 +40,8 @@ class TestAuthentication {
/**
* proxyAuthentication method
*
* @param HttpSocket $http
* @param array $proxyInfo
* @param HttpSocket $http A HTTP socket.
* @param array &$proxyInfo Some proxy info.
* @return void
*/
public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) {
@ -52,7 +52,6 @@ class TestAuthentication {
/**
* CustomResponse
*
*/
class CustomResponse {
@ -66,6 +65,7 @@ class CustomResponse {
/**
* Constructor
*
* @param string $message A message.
*/
public function __construct($message) {
$this->first10 = substr($message, 0, 10);
@ -75,7 +75,6 @@ class CustomResponse {
/**
* TestHttpSocket
*
*/
class TestHttpSocket extends HttpSocket {
@ -135,7 +134,6 @@ class TestHttpSocket extends HttpSocket {
* Convenience method for testing protected method
*
* @param array $request Needs to contain a 'uri' key. Should also contain a 'method' key, otherwise defaults to GET.
* @param string $versionToken The version token to use, defaults to HTTP/1.1
* @return string Request line
*/
public function buildRequestLine($request = array()) {
@ -583,7 +581,7 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->reset();
$request = array('method' => 'POST', 'uri' => 'http://www.cakephp.org/posts/add', 'body' => array('name' => 'HttpSocket-is-released', 'date' => 'today'));
$response = $this->Socket->request($request);
$this->Socket->request($request);
$this->assertEquals("name=HttpSocket-is-released&date=today", $this->Socket->request['body']);
}

View file

@ -258,7 +258,6 @@ class AssetDispatcherTest extends CakeTestCase {
$file = file_get_contents($path);
$this->assertEquals($file, $result);
$expected = filesize($path);
$headers = $response->header();
$this->assertFalse($headers['Content-Length']);
}

View file

@ -47,14 +47,14 @@ class RedirectRouteTest extends CakeTestCase {
$route = new RedirectRoute('/home', array('controller' => 'posts'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/home');
$route->parse('/home');
$header = $route->response->header();
$this->assertEquals(Router::url('/posts', true), $header['Location']);
$route = new RedirectRoute('/home', array('controller' => 'posts', 'action' => 'index'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/home');
$route->parse('/home');
$header = $route->response->header();
$this->assertEquals(Router::url('/posts', true), $header['Location']);
$this->assertEquals(301, $route->response->statusCode());
@ -62,14 +62,14 @@ class RedirectRouteTest extends CakeTestCase {
$route = new RedirectRoute('/google', 'http://google.com');
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/google');
$route->parse('/google');
$header = $route->response->header();
$this->assertEquals('http://google.com', $header['Location']);
$route = new RedirectRoute('/posts/*', array('controller' => 'posts', 'action' => 'view'), array('status' => 302));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$route->parse('/posts/2');
$header = $route->response->header();
$this->assertEquals(Router::url('/posts/view', true), $header['Location']);
$this->assertEquals(302, $route->response->statusCode());
@ -77,35 +77,35 @@ class RedirectRouteTest extends CakeTestCase {
$route = new RedirectRoute('/posts/*', array('controller' => 'posts', 'action' => 'view'), array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$route->parse('/posts/2');
$header = $route->response->header();
$this->assertEquals(Router::url('/posts/view/2', true), $header['Location']);
$route = new RedirectRoute('/posts/*', '/test', array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/posts/2');
$route->parse('/posts/2');
$header = $route->response->header();
$this->assertEquals(Router::url('/test', true), $header['Location']);
$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'), array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$route->parse('/my_controllers/do_something/passme/named:param');
$header = $route->response->header();
$this->assertEquals(Router::url('/tags/add/passme/named:param', true), $header['Location']);
$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$route->parse('/my_controllers/do_something/passme/named:param');
$header = $route->response->header();
$this->assertEquals(Router::url('/tags/add', true), $header['Location']);
$route = new RedirectRoute('/:lang/my_controllers', array('controller' => 'tags', 'action' => 'add'), array('lang' => '(nl|en)', 'persist' => array('lang')));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/nl/my_controllers/');
$route->parse('/nl/my_controllers/');
$header = $route->response->header();
$this->assertEquals(Router::url('/tags/add/lang:nl', true), $header['Location']);
@ -114,7 +114,7 @@ class RedirectRouteTest extends CakeTestCase {
$route = new RedirectRoute('/:lang/my_controllers', array('controller' => 'tags', 'action' => 'add'), array('lang' => '(nl|en)', 'persist' => array('lang')));
$route->stop = false;
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
$result = $route->parse('/nl/my_controllers/');
$route->parse('/nl/my_controllers/');
$header = $route->response->header();
$this->assertEquals(Router::url('/nl/preferred_controllers', true), $header['Location']);
}

View file

@ -201,7 +201,7 @@ class RouterTest extends CakeTestCase {
));
CakePlugin::load('TestPlugin');
App::uses('TestRoute', 'TestPlugin.Routing/Route');
$resources = Router::mapResources('Posts', array(
Router::mapResources('Posts', array(
'connectOptions' => array(
'routeClass' => 'TestPlugin.TestRoute',
'foo' => '^(bar)$',
@ -238,7 +238,7 @@ class RouterTest extends CakeTestCase {
$this->assertEquals($expected, $result);
$this->assertEquals(array('test_plugin'), $resources);
$resources = Router::mapResources('Posts', array('prefix' => 'api'));
Router::mapResources('Posts', array('prefix' => 'api'));
$_SERVER['REQUEST_METHOD'] = 'GET';
$result = Router::parse('/api/posts');
@ -1579,7 +1579,7 @@ class RouterTest extends CakeTestCase {
$request->base = '/';
Router::setRequestInfo($request);
$result = Router::parse('/admin/controller/index/type:whatever');
Router::parse('/admin/controller/index/type:whatever');
$result = Router::url(array('type' => 'new'));
$expected = "/admin/controller/index/type:new";
$this->assertEquals($expected, $result);

View file

@ -327,7 +327,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextStartsWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertStringStartsWith("some\nstring", $stringDirty);
$this->assertStringStartsNotWith("some\r\nstring\r\nwith", $stringDirty);
@ -344,7 +344,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextStartsNotWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertTextStartsNotWith("some\nstring\nwithout", $stringDirty);
}
@ -356,7 +356,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextEndsWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertTextEndsWith("string\nwith\r\ndifferent\rline endings!", $stringDirty);
$this->assertTextEndsWith("string\r\nwith\ndifferent\nline endings!", $stringDirty);
@ -369,7 +369,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextEndsNotWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertStringEndsNotWith("different\nline endings", $stringDirty);
$this->assertTextEndsNotWith("different\rline endings", $stringDirty);
@ -382,7 +382,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextContains() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertContains("different", $stringDirty);
$this->assertNotContains("different\rline", $stringDirty);
@ -397,7 +397,7 @@ class CakeTestCaseTest extends CakeTestCase {
*/
public function testAssertTextNotContains() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
// $stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertTextNotContains("different\rlines", $stringDirty);
}
@ -460,7 +460,7 @@ class CakeTestCaseTest extends CakeTestCase {
), App::RESET);
CakePlugin::load('TestPlugin');
$this->getMockForModel('TestPlugin.TestPluginAppModel');
$TestPluginComment = $this->getMockForModel('TestPlugin.TestPluginComment');
$this->getMockForModel('TestPlugin.TestPluginComment');
$result = ClassRegistry::init('TestPlugin.TestPluginComment');
$this->assertInstanceOf('TestPluginComment', $result);

View file

@ -534,7 +534,7 @@ class CakeTestFixtureTest extends CakeTestCase {
*/
public function testInsertInvalid() {
$Fixture = new InvalidTestFixture();
$return = $Fixture->insert($this->criticDb);
$Fixture->insert($this->criticDb);
}
/**

View file

@ -276,7 +276,7 @@ class ControllerTestCaseTest extends CakeTestCase {
* @return void
*/
public function testTestAction() {
$Controller = $this->Case->generate('TestsApps');
$this->Case->generate('TestsApps');
$this->Case->testAction('/tests_apps/index');
$this->assertInternalType('array', $this->Case->controller->viewVars);
@ -306,7 +306,7 @@ class ControllerTestCaseTest extends CakeTestCase {
* @return void
*/
public function testTestActionArrayUrls() {
$Controller = $this->Case->generate('TestsApps');
$this->Case->generate('TestsApps');
$this->Case->testAction(array('controller' => 'tests_apps', 'action' => 'index'));
$this->assertInternalType('array', $this->Case->controller->viewVars);
}
@ -452,7 +452,7 @@ class ControllerTestCaseTest extends CakeTestCase {
public function testTestActionGetData() {
$this->Case->autoMock = true;
$result = $this->Case->testAction('/tests_apps_posts/url_var', array(
$this->Case->testAction('/tests_apps_posts/url_var', array(
'method' => 'get',
'data' => array(
'some' => 'var',
@ -474,7 +474,7 @@ class ControllerTestCaseTest extends CakeTestCase {
));
$this->assertEquals(array('gogo', 'val2'), $result['params']['pass']);
$result = $this->Case->testAction('/tests_apps_posts/url_var', array(
$this->Case->testAction('/tests_apps_posts/url_var', array(
'return' => 'vars',
'method' => 'get',
'data' => array(

View file

@ -1026,7 +1026,7 @@ class FolderTest extends CakeTestCase {
extract($this->_setupFilesystem());
$Folder = new Folder($folderOne);
$result = $Folder->copy(array('to' => $folderThree, 'scheme' => Folder::OVERWRITE));
$Folder->copy(array('to' => $folderThree, 'scheme' => Folder::OVERWRITE));
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
$this->assertTrue(file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php'));

View file

@ -27,8 +27,8 @@ class GenericObject {
/**
* Constructor
*
* @param GenericObjectCollection $collection
* @param array $settings
* @param GenericObjectCollection $collection A collection.
* @param array $settings Settings.
*/
public function __construct(GenericObjectCollection $collection, $settings = array()) {
$this->_Collection = $collection;

View file

@ -154,7 +154,7 @@ class SanitizeTest extends CakeTestCase {
$string = '';
$expected = '';
$result = Sanitize::clean($string, array('connection' => 'test'));
$this->assertEquals($expected, $string);
$this->assertEquals($expected, $result);
$data = array(
'Grant' => array(

View file

@ -324,7 +324,7 @@ class SecurityTest extends CakeTestCase {
public function testDecryptKeyFailure() {
$txt = 'The quick brown fox';
$key = 'This key is longer than 32 bytes long.';
$result = Security::encrypt($txt, $key);
Security::encrypt($txt, $key);
$key = 'Not the same key. This one will fail';
$this->assertFalse(Security::decrypt($txt, $key), 'Modified key will fail.');

View file

@ -2763,7 +2763,6 @@ class SetTest extends CakeTestCase {
/**
* testSetApply method
* @return void
*
*/
public function testApply() {
$data = array(

View file

@ -28,7 +28,7 @@ class CustomValidator {
/**
* Makes sure that a given $email address is valid and unique
*
* @param string $email
* @param string $check Email to check.
* @return bool
*/
public static function customValidate($check) {

View file

@ -175,7 +175,7 @@ class XmlTest extends CakeTestCase {
*/
public function testBuildFromFileWhenDisabled() {
$xml = CAKE . 'Test' . DS . 'Fixture' . DS . 'sample.xml';
$obj = Xml::build($xml, array('readFile' => false));
Xml::build($xml, array('readFile' => false));
}
/**
@ -186,7 +186,7 @@ class XmlTest extends CakeTestCase {
*/
public function testBuildFromUrlWhenDisabled() {
$xml = 'http://www.google.com';
$obj = Xml::build($xml, array('readFile' => false));
Xml::build($xml, array('readFile' => false));
}
/**
@ -222,7 +222,7 @@ class XmlTest extends CakeTestCase {
*/
public function testBuildInvalidDataSimpleXml() {
$input = '<derp';
$xml = Xml::build($input, array('return' => 'simplexml'));
Xml::build($input, array('return' => 'simplexml'));
}
/**

View file

@ -2,7 +2,6 @@
App::uses('AppController', 'Controller');
/**
* Articles Controller
*
*/
class ArticlesController extends AppController {

View file

@ -1,7 +1,6 @@
<?php
/**
* Test suite app/Model/Datasource/Session session handler
*
*/
App::uses('CakeSessionHandlerInterface', 'Model/Datasource/Session');

View file

@ -8,4 +8,3 @@ test plugin error500
if (Configure::read('debug') > 0):
echo $this->element('exception_stack_trace');
endif;
?>

View file

@ -1,3 +1,2 @@
<?php
echo $this->Html->link('Test', 'http://example.com');
?>

View file

@ -4,4 +4,3 @@ $content = explode("\n", $content);
foreach ($content as $line):
echo '<p> ' . $line . '</p>';
endforeach;
?>

View file

@ -1,2 +1,3 @@
Ajax!
<?php echo $this->fetch('content'); ?>
<?php
echo $this->fetch('content');

View file

@ -13,5 +13,3 @@ echo $this->Rss->document(
array(), $channel, $this->fetch('content')
)
);
?>

View file

@ -1,4 +1,3 @@
<?php
echo $html;
echo $this->Html->link('Test link', '#');
?>

View file

@ -1,2 +1,2 @@
Parent View.
<?php echo $this->fetch('content') ?>
<?php echo $this->fetch('content'); ?>

View file

@ -47,7 +47,7 @@
<?php
echo __d('cake', 'Your database configuration file is ');
$filePresent = null;
if (file_exists(APP . 'Config'.'database.php')):
if (file_exists(APP . 'Config' . 'database.php')):
echo __d('cake', 'present.');
$filePresent = true;
else:

View file

@ -1,2 +1,2 @@
In TestTheme
<?php echo $this->Html->image('test.jpg') ?>
<?php echo $this->Html->image('test.jpg'); ?>

View file

@ -1,2 +1,2 @@
default test_theme layout
<?php echo $this->fetch('content') ?>
<?php echo $this->fetch('content'); ?>

View file

@ -643,9 +643,9 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
/**
* Compatibility wrapper function for setExpectedException
*
* @param mixed $expected the name of the Exception
* @param mixed $name The name of the expected Exception.
* @param string $message the text to display if the assertion is not correct
* @deprecated 3.0.0 This is a compatiblity wrapper for 1.x. It will be removed in 3.0
* @deprecated 3.0.0 This is a compatibility wrapper for 1.x. It will be removed in 3.0.
* @return void
*/
protected function expectException($name = 'Exception', $message = '') {

View file

@ -42,9 +42,9 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
/**
* Convert path fragments used by CakePHP's test runner to absolute paths that can be fed to PHPUnit.
*
* @param string $filePath The file path to load
* @param string $params Additional parameters
* @return void
* @param string $filePath The file path to load.
* @param string $params Additional parameters.
* @return string Converted path fragments.
*/
protected function _resolveTestFile($filePath, $params) {
$basePath = $this->_basePath($params) . DS . $filePath;

View file

@ -258,7 +258,7 @@ abstract class ControllerTestCase extends CakeTestCase {
$Dispatch->parseParams(new CakeEvent('ControllerTestCase', $Dispatch, array('request' => $request)));
if (!isset($request->params['controller']) && Router::currentRoute()) {
$this->headers = Router::currentRoute()->response->header();
return;
return null;
}
if ($this->_dirtyController) {
$this->controller = null;

View file

@ -58,7 +58,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*/
public function paintDocumentStart() {
ob_start();
$baseDir = $this->params['baseDir'];
$this->params['baseDir'];
include CAKE . 'TestSuite' . DS . 'templates' . DS . 'header.php';
}
@ -69,7 +69,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @return void
*/
public function paintTestMenu() {
$cases = $this->baseUrl() . '?show=cases';
$this->baseUrl() . '?show=cases';
$plugins = App::objects('plugin', null, false);
sort($plugins);
include CAKE . 'TestSuite' . DS . 'templates' . DS . 'menu.php';

View file

@ -106,7 +106,7 @@
div.code-coverage-results span.line-num strong { color:#666; }
div.code-coverage-results div.start {
border:1px solid #aaa;
border-width:1px 1px 0px 1px;
border-width:1px 1px 0 1px;
margin-top:30px;
padding-top:5px;
}