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($parser, $result, 'Setting description is not chainable');
$this->assertEquals('A test', $parser->description(), 'getting value is wrong.'); $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.'); $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($parser, $result, 'Setting epilog is not chainable');
$this->assertEquals('A test', $parser->epilog(), 'getting value is wrong.'); $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.'); $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); $expected = array('name' => 'mark', 'help' => false);
$this->assertEquals($expected, $result[0], 'Got the correct value.'); $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); $result = $parser->parse($expected);
$this->assertEquals($expected, $result[1], 'Arguments are not as 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'); $expected = array('mark', 'samurai', 'sword');
$this->assertEquals($expected, $result[1], 'Got the correct value.'); $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 * construct method
*
*/ */
public function __construct() { public function __construct() {
$this->Aro = new AroTwoTest(); $this->Aro = new AroTwoTest();

View file

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

View file

@ -176,7 +176,6 @@ class AuthTestController extends Controller {
/** /**
* construct method * construct method
*
*/ */
public function __construct($request, $response) { public function __construct($request, $response) {
$request->addParams(Router::parse('/auth_test')); $request->addParams(Router::parse('/auth_test'));
@ -1319,7 +1318,7 @@ class AuthComponentTest extends CakeTestCase {
->with('HTTP/1.1 403 Forbidden', null); ->with('HTTP/1.1 403 Forbidden', null);
$this->Auth->initialize($this->Controller); $this->Auth->initialize($this->Controller);
$result = $this->Auth->startup($this->Controller); $this->Auth->startup($this->Controller);
$this->assertArrayNotHasKey('Location', $this->Controller->response->header()); $this->assertArrayNotHasKey('Location', $this->Controller->response->header());
$this->assertNull($this->Controller->testUrl, 'redirect() not called'); $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->request->params['named'] = array('limit' => 12);
$Controller->Paginator->settings = array('limit' => 30, 'maxLimit' => 100, 'paramType' => 'named'); $Controller->Paginator->settings = array('limit' => 30, 'maxLimit' => 100, 'paramType' => 'named');
$result = $Controller->Paginator->paginate('PaginatorControllerPost'); $Controller->Paginator->paginate('PaginatorControllerPost');
$paging = $Controller->params['paging']['PaginatorControllerPost']; $paging = $Controller->params['paging']['PaginatorControllerPost'];
$this->assertEquals(12, $Controller->PaginatorControllerPost->lastQueries[0]['limit']); $this->assertEquals(12, $Controller->PaginatorControllerPost->lastQueries[0]['limit']);
@ -504,7 +504,7 @@ class PaginatorComponentTest extends CakeTestCase {
'paramType' => 'named' 'paramType' => 'named'
) )
); );
$result = $Controller->Paginator->paginate('ControllerPaginateModel'); $Controller->Paginator->paginate('ControllerPaginateModel');
$expected = array( $expected = array(
'contain' => array('ControllerPaginateModel'), 'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id', 'group' => 'Comment.author_id',

View file

@ -653,7 +653,7 @@ class ControllerTest extends CakeTestCase {
$expected = $Controller->ControllerComment->validationErrors; $expected = $Controller->ControllerComment->validationErrors;
$Controller->viewPath = 'Posts'; $Controller->viewPath = 'Posts';
$result = $Controller->render('index'); $Controller->render('index');
$View = $Controller->View; $View = $Controller->View;
$this->assertTrue(isset($View->validationErrors['ControllerComment'])); $this->assertTrue(isset($View->validationErrors['ControllerComment']));
$this->assertEquals($expected, $View->validationErrors['ControllerComment']); $this->assertEquals($expected, $View->validationErrors['ControllerComment']);

View file

@ -20,7 +20,6 @@ App::uses('CakePlugin', 'Core');
/** /**
* CakePluginTest class * CakePluginTest class
*
*/ */
class CakePluginTest extends CakeTestCase { 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 * Test to ensure bootrapping doesn't overwrite prior configs set under 'App' key
*
* @return void * @return void
*/ */
public function testBootstrap() { public function testBootstrap() {
@ -469,6 +470,8 @@ class ConfigureTest extends CakeTestCase {
} }
/** /**
* testDumpNoAdapter
*
* @expectedException ConfigureException * @expectedException ConfigureException
* @return void * @return void
*/ */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -318,12 +318,6 @@ class CakeRequestTest extends CakeTestCase {
$request->reConstruct(); $request->reConstruct();
$this->assertEquals($data, $request->data); $this->assertEquals($data, $request->data);
$data = array(
'data' => array(
'Article' => array('title' => 'Testing'),
),
'action' => 'update'
);
$request = $this->getMock('TestCakeRequest', array('_readInput')); $request = $this->getMock('TestCakeRequest', array('_readInput'));
$request->expects($this->at(0))->method('_readInput') $request->expects($this->at(0))->method('_readInput')
->will($this->returnValue('data[Article][title]=Testing&action=update')); ->will($this->returnValue('data[Article][title]=Testing&action=update'));
@ -2261,7 +2255,7 @@ class CakeRequestTest extends CakeTestCase {
// Checking if requested // Checking if requested
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx,en_ca'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx,en_ca';
$result = CakeRequest::acceptLanguage(); CakeRequest::acceptLanguage();
$result = CakeRequest::acceptLanguage('en-ca'); $result = CakeRequest::acceptLanguage('en-ca');
$this->assertTrue($result); $this->assertTrue($result);

View file

@ -566,7 +566,7 @@ class CakeResponseTest extends CakeTestCase {
$response->send(); $response->send();
ob_start(); ob_start();
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
$goofyOutput = 'I am goofily sending output in the controller'; $goofyOutput = 'I am goofily sending output in the controller';
echo $goofyOutput; echo $goofyOutput;
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
@ -1746,7 +1746,7 @@ class CakeResponseTest extends CakeTestCase {
); );
$this->assertEquals(416, $response->statusCode()); $this->assertEquals(416, $response->statusCode());
$result = $response->send(); $response->send();
} }
/** /**
@ -1787,7 +1787,7 @@ class CakeResponseTest extends CakeTestCase {
); );
ob_start(); ob_start();
$result = $response->send(); $response->send();
ob_get_clean(); ob_get_clean();
} }
@ -1876,7 +1876,7 @@ class CakeResponseTest extends CakeTestCase {
); );
$this->assertEquals(416, $response->statusCode()); $this->assertEquals(416, $response->statusCode());
$result = $response->send(); $response->send();
} }
/** /**

View file

@ -21,7 +21,6 @@ App::uses('File', 'Utility');
/** /**
* Help to test CakeEmail * Help to test CakeEmail
*
*/ */
class TestCakeEmail extends CakeEmail { class TestCakeEmail extends CakeEmail {
@ -36,7 +35,6 @@ class TestCakeEmail extends CakeEmail {
/** /**
* Config * Config
*
*/ */
protected $_config = array(); protected $_config = array();
@ -89,7 +87,6 @@ class TestCakeEmail extends CakeEmail {
/** /**
* EmailConfig class * EmailConfig class
*
*/ */
class TestEmailConfig { class TestEmailConfig {
@ -135,7 +132,6 @@ class TestEmailConfig {
/** /**
* ExtendTransport class * ExtendTransport class
* test class to ensure the class has send() method * test class to ensure the class has send() method
*
*/ */
class ExtendTransport { class ExtendTransport {
@ -217,7 +213,7 @@ class CakeEmailTest extends CakeTestCase {
$this->assertSame($this->CakeEmail, $result); $this->assertSame($this->CakeEmail, $result);
$this->setExpectedException('SocketException'); $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->setExpectedException('SocketException');
$this->CakeEmail->transport('Invalid'); $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->assertEquals($expected, $this->CakeEmail->transportClass()->config());
$this->CakeEmail->config(array('log' => true)); $this->CakeEmail->config(array('log' => true));
$result = $this->CakeEmail->transportClass()->config(); $this->CakeEmail->transportClass()->config();
$expected += array('log' => true); $expected += array('log' => true);
$this->assertEquals($expected, $this->CakeEmail->transportClass()->config()); $this->assertEquals($expected, $this->CakeEmail->transportClass()->config());
@ -2028,7 +2024,7 @@ class CakeEmailTest extends CakeTestCase {
$this->assertEquals('html', $result); $this->assertEquals('html', $result);
$this->setExpectedException('SocketException'); $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> style="font-weight: bold">The tag is across multiple lines</th>
</table> </table>
HTML; HTML;
$length = strlen($str);
$message = $str . str_repeat('x', CakeEmail::LINE_LENGTH_MUST + 1); $message = $str . str_repeat('x', CakeEmail::LINE_LENGTH_MUST + 1);
$this->CakeEmail->reset(); $this->CakeEmail->reset();

View file

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

View file

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

View file

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

View file

@ -29,8 +29,8 @@ class TestAuthentication {
/** /**
* authentication method * authentication method
* *
* @param HttpSocket $http * @param HttpSocket $http A HTTP socket.
* @param array $authInfo * @param array &$authInfo Some auth info.
* @return void * @return void
*/ */
public static function authentication(HttpSocket $http, &$authInfo) { public static function authentication(HttpSocket $http, &$authInfo) {
@ -40,8 +40,8 @@ class TestAuthentication {
/** /**
* proxyAuthentication method * proxyAuthentication method
* *
* @param HttpSocket $http * @param HttpSocket $http A HTTP socket.
* @param array $proxyInfo * @param array &$proxyInfo Some proxy info.
* @return void * @return void
*/ */
public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) { public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) {
@ -52,7 +52,6 @@ class TestAuthentication {
/** /**
* CustomResponse * CustomResponse
*
*/ */
class CustomResponse { class CustomResponse {
@ -66,6 +65,7 @@ class CustomResponse {
/** /**
* Constructor * Constructor
* *
* @param string $message A message.
*/ */
public function __construct($message) { public function __construct($message) {
$this->first10 = substr($message, 0, 10); $this->first10 = substr($message, 0, 10);
@ -75,7 +75,6 @@ class CustomResponse {
/** /**
* TestHttpSocket * TestHttpSocket
*
*/ */
class TestHttpSocket extends HttpSocket { class TestHttpSocket extends HttpSocket {
@ -135,7 +134,6 @@ class TestHttpSocket extends HttpSocket {
* Convenience method for testing protected method * 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 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 * @return string Request line
*/ */
public function buildRequestLine($request = array()) { public function buildRequestLine($request = array()) {
@ -583,7 +581,7 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->reset(); $this->Socket->reset();
$request = array('method' => 'POST', 'uri' => 'http://www.cakephp.org/posts/add', 'body' => array('name' => 'HttpSocket-is-released', 'date' => 'today')); $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']); $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); $file = file_get_contents($path);
$this->assertEquals($file, $result); $this->assertEquals($file, $result);
$expected = filesize($path);
$headers = $response->header(); $headers = $response->header();
$this->assertFalse($headers['Content-Length']); $this->assertFalse($headers['Content-Length']);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1026,7 +1026,7 @@ class FolderTest extends CakeTestCase {
extract($this->_setupFilesystem()); extract($this->_setupFilesystem());
$Folder = new Folder($folderOne); $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 . 'file1.php'));
$this->assertTrue(file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php')); $this->assertTrue(file_exists($folderThree . DS . 'folderA' . DS . 'fileA.php'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -175,7 +175,7 @@ class XmlTest extends CakeTestCase {
*/ */
public function testBuildFromFileWhenDisabled() { public function testBuildFromFileWhenDisabled() {
$xml = CAKE . 'Test' . DS . 'Fixture' . DS . 'sample.xml'; $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() { public function testBuildFromUrlWhenDisabled() {
$xml = 'http://www.google.com'; $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() { public function testBuildInvalidDataSimpleXml() {
$input = '<derp'; $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'); App::uses('AppController', 'Controller');
/** /**
* Articles Controller * Articles Controller
*
*/ */
class ArticlesController extends AppController { class ArticlesController extends AppController {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,2 +1,3 @@
Ajax! 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') array(), $channel, $this->fetch('content')
) )
); );
?>

View file

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

View file

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

View file

@ -1,2 +1,2 @@
In TestTheme 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 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 * 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 * @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 * @return void
*/ */
protected function expectException($name = 'Exception', $message = '') { 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. * 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 $filePath The file path to load.
* @param string $params Additional parameters * @param string $params Additional parameters.
* @return void * @return string Converted path fragments.
*/ */
protected function _resolveTestFile($filePath, $params) { protected function _resolveTestFile($filePath, $params) {
$basePath = $this->_basePath($params) . DS . $filePath; $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))); $Dispatch->parseParams(new CakeEvent('ControllerTestCase', $Dispatch, array('request' => $request)));
if (!isset($request->params['controller']) && Router::currentRoute()) { if (!isset($request->params['controller']) && Router::currentRoute()) {
$this->headers = Router::currentRoute()->response->header(); $this->headers = Router::currentRoute()->response->header();
return; return null;
} }
if ($this->_dirtyController) { if ($this->_dirtyController) {
$this->controller = null; $this->controller = null;

View file

@ -58,7 +58,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
*/ */
public function paintDocumentStart() { public function paintDocumentStart() {
ob_start(); ob_start();
$baseDir = $this->params['baseDir']; $this->params['baseDir'];
include CAKE . 'TestSuite' . DS . 'templates' . DS . 'header.php'; include CAKE . 'TestSuite' . DS . 'templates' . DS . 'header.php';
} }
@ -69,7 +69,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @return void * @return void
*/ */
public function paintTestMenu() { public function paintTestMenu() {
$cases = $this->baseUrl() . '?show=cases'; $this->baseUrl() . '?show=cases';
$plugins = App::objects('plugin', null, false); $plugins = App::objects('plugin', null, false);
sort($plugins); sort($plugins);
include CAKE . 'TestSuite' . DS . 'templates' . DS . 'menu.php'; 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 span.line-num strong { color:#666; }
div.code-coverage-results div.start { div.code-coverage-results div.start {
border:1px solid #aaa; border:1px solid #aaa;
border-width:1px 1px 0px 1px; border-width:1px 1px 0 1px;
margin-top:30px; margin-top:30px;
padding-top:5px; padding-top:5px;
} }