Skip to content
Permalink
Browse files

Use simple strings where applicable

  • Loading branch information...
bcrowe committed Jun 19, 2017
1 parent 0b6a1fe commit 228e9ca1cfcfbe28f1965b8bebc66d52b1d3aeca
Showing with 222 additions and 222 deletions.
  1. +1 −1 src/Console/ConsoleErrorHandler.php
  2. +9 −9 src/Shell/CommandListShell.php
  3. +3 −3 src/Shell/RoutesShell.php
  4. +1 −1 src/Shell/ServerShell.php
  5. +1 −1 src/Shell/Task/ExtractTask.php
  6. +1 −1 tests/TestCase/Console/ConsoleErrorHandlerTest.php
  7. +7 −7 tests/TestCase/Console/ConsoleIoTest.php
  8. +2 −2 tests/TestCase/Console/ConsoleOutputTest.php
  9. +3 −3 tests/TestCase/Console/ShellTest.php
  10. +4 −4 tests/TestCase/Controller/Component/CookieComponentTest.php
  11. +8 −8 tests/TestCase/Controller/ControllerTest.php
  12. +2 −2 tests/TestCase/Core/ConfigureTest.php
  13. +3 −3 tests/TestCase/Core/StaticConfigTraitTest.php
  14. +2 −2 tests/TestCase/Database/Driver/MysqlTest.php
  15. +4 −4 tests/TestCase/Database/Expression/FunctionExpressionTest.php
  16. +10 −10 tests/TestCase/Database/FunctionsBuilderTest.php
  17. +1 −1 tests/TestCase/Error/DebuggerTest.php
  18. +1 −1 tests/TestCase/Error/ExceptionRendererTest.php
  19. +3 −3 tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php
  20. +21 −21 tests/TestCase/Http/ResponseTest.php
  21. +6 −6 tests/TestCase/Http/ServerRequestTest.php
  22. +1 −1 tests/TestCase/I18n/TimeTest.php
  23. +1 −1 tests/TestCase/Log/Engine/ConsoleLogTest.php
  24. +29 −29 tests/TestCase/Mailer/EmailTest.php
  25. +2 −2 tests/TestCase/Mailer/Transport/DebugTransportTest.php
  26. +11 −11 tests/TestCase/Mailer/Transport/MailTransportTest.php
  27. +1 −1 tests/TestCase/Mailer/Transport/SmtpTransportTest.php
  28. +2 −2 tests/TestCase/Network/SessionTest.php
  29. +3 −3 tests/TestCase/ORM/QueryRegressionTest.php
  30. +3 −3 tests/TestCase/Routing/Filter/RoutingFilterTest.php
  31. +2 −2 tests/TestCase/Routing/Route/RouteTest.php
  32. +4 −4 tests/TestCase/Routing/RouterTest.php
  33. +4 −4 tests/TestCase/Shell/CompletionShellTest.php
  34. +2 −2 tests/TestCase/Shell/Task/UnloadTaskTest.php
  35. +1 −1 tests/TestCase/TestSuite/AssertHtmlTest.php
  36. +1 −1 tests/TestCase/TestSuite/TestCaseTest.php
  37. +14 −14 tests/TestCase/Utility/TextTest.php
  38. +7 −7 tests/TestCase/Validation/ValidationTest.php
  39. +2 −2 tests/TestCase/View/CellTest.php
  40. +18 −18 tests/TestCase/View/Helper/FormHelperTest.php
  41. +1 −1 tests/TestCase/View/Helper/HtmlHelperTest.php
  42. +13 −13 tests/TestCase/View/Helper/RssHelperTest.php
  43. +4 −4 tests/TestCase/View/Helper/UrlHelperTest.php
  44. +3 −3 tests/test_app/TestApp/Controller/AuthTestController.php
@@ -90,7 +90,7 @@ protected function _displayException($exception)
}
$message = sprintf(
"<error>%s</error> %s in [%s, line %s]",
'<error>%s</error> %s in [%s, line %s]',
$errorName,
$exception->getMessage(),
$exception->getFile(),
@@ -56,13 +56,13 @@ public function startup()
public function main()
{
if (!$this->param('xml') && !$this->param('version')) {
$this->out("<info>Current Paths:</info>", 2);
$this->out("* app: " . APP_DIR);
$this->out("* root: " . rtrim(ROOT, DIRECTORY_SEPARATOR));
$this->out("* core: " . rtrim(CORE_PATH, DIRECTORY_SEPARATOR));
$this->out("");
$this->out('<info>Current Paths:</info>', 2);
$this->out('* app: ' . APP_DIR);
$this->out('* root: ' . rtrim(ROOT, DIRECTORY_SEPARATOR));
$this->out('* core: ' . rtrim(CORE_PATH, DIRECTORY_SEPARATOR));
$this->out('');
$this->out("<info>Available Shells:</info>", 2);
$this->out('<info>Available Shells:</info>', 2);
}
if ($this->param('version')) {
@@ -97,9 +97,9 @@ protected function _asText($shellList)
$this->out();
}
$this->out("To run an app or core command, type <info>`cake shell_name [args]`</info>");
$this->out("To run a plugin command, type <info>`cake Plugin.shell_name [args]`</info>");
$this->out("To get help on a specific command, type <info>`cake shell_name --help`</info>", 2);
$this->out('To run an app or core command, type <info>`cake shell_name [args]`</info>');
$this->out('To run a plugin command, type <info>`cake Plugin.shell_name [args]`</info>');
$this->out('To get help on a specific command, type <info>`cake shell_name --help`</info>', 2);
}
/**
@@ -93,7 +93,7 @@ public function generate()
$this->out("> $url");
$this->out();
} catch (MissingRouteException $e) {
$this->err("<warning>The provided parameters do not match any routes.</warning>");
$this->err('<warning>The provided parameters do not match any routes.</warning>');
$this->out();
return false;
@@ -119,8 +119,8 @@ public function getOptionParser()
])->addSubcommand('generate', [
'help' => 'Check a routing array against the routes. ' .
"Will output the URL if there is a match.\n\n" .
"Routing parameters should be supplied in a key:value format. " .
"For example `controller:Articles action:view 2`"
'Routing parameters should be supplied in a key:value format. ' .
'For example `controller:Articles action:view 2`'
]);
return $parser;
@@ -128,7 +128,7 @@ protected function _welcome()
public function main()
{
$command = sprintf(
"php -S %s:%d -t %s %s",
'php -S %s:%d -t %s %s',
$this->_host,
$this->_port,
escapeshellarg($this->_documentRoot),
@@ -656,7 +656,7 @@ protected function _formatString($string)
if ($quote === '"') {
$string = stripcslashes($string);
} else {
$string = strtr($string, ["\\'" => "'", "\\\\" => "\\"]);
$string = strtr($string, ["\\'" => "'", '\\\\' => '\\']);
}
$string = str_replace("\r\n", "\n", $string);
@@ -80,7 +80,7 @@ public function testHandleError()
public function testHandleFatalError()
{
ob_start();
$content = "<error>Fatal Error:</error> This is a fatal error in [/some/file, line 275]";
$content = '<error>Fatal Error:</error> This is a fatal error in [/some/file, line 275]';
$this->stderr->expects($this->once())->method('write')
->with($this->stringContains($content));
@@ -141,7 +141,7 @@ public function testOut()
{
$this->out->expects($this->at(0))
->method('write')
->with("Just a test", 1);
->with('Just a test', 1);
$this->out->expects($this->at(1))
->method('write')
@@ -238,7 +238,7 @@ public function testErr()
{
$this->err->expects($this->at(0))
->method('write')
->with("Just a test", 1);
->with('Just a test', 1);
$this->err->expects($this->at(1))
->method('write')
@@ -271,7 +271,7 @@ public function testNl()
}
$this->assertEquals($this->io->nl(), $newLine);
$this->assertEquals($this->io->nl(true), $newLine);
$this->assertEquals("", $this->io->nl(false));
$this->assertEquals('', $this->io->nl(false));
$this->assertEquals($this->io->nl(2), $newLine . $newLine);
$this->assertEquals($this->io->nl(1), $newLine);
}
@@ -289,13 +289,13 @@ public function testHr()
$this->out->expects($this->at(1))->method('write')->with($bar, 1);
$this->out->expects($this->at(2))->method('write')->with('', 0);
$this->out->expects($this->at(3))->method('write')->with("", true);
$this->out->expects($this->at(3))->method('write')->with('', true);
$this->out->expects($this->at(4))->method('write')->with($bar, 1);
$this->out->expects($this->at(5))->method('write')->with("", true);
$this->out->expects($this->at(5))->method('write')->with('', true);
$this->out->expects($this->at(6))->method('write')->with("", 2);
$this->out->expects($this->at(6))->method('write')->with('', 2);
$this->out->expects($this->at(7))->method('write')->with($bar, 1);
$this->out->expects($this->at(8))->method('write')->with("", 2);
$this->out->expects($this->at(8))->method('write')->with('', 2);
$this->io->hr();
$this->io->hr(true);
@@ -157,7 +157,7 @@ public function testFormattingSimple()
public function testFormattingNotEatingTags()
{
$this->output->expects($this->once())->method('_write')
->with("<red> Something bad");
->with('<red> Something bad');
$this->output->write('<red> Something bad', false);
}
@@ -190,7 +190,7 @@ public function testFormattingCustom()
public function testFormattingMissingStyleName()
{
$this->output->expects($this->once())->method('_write')
->with("<not_there>Error:</not_there> Something bad");
->with('<not_there>Error:</not_there> Something bad');
$this->output->write('<not_there>Error:</not_there> Something bad', false);
}
@@ -393,7 +393,7 @@ public function testError()
$this->io->expects($this->at(1))
->method('err')
->with("Searched all...");
->with('Searched all...');
$this->Shell->error('Foo Not Found', 'Searched all...');
$this->assertSame($this->Shell->stopped, 1);
@@ -529,7 +529,7 @@ public function testCreateFileNoReply()
touch($file);
$this->assertFileExists($file);
$contents = "My content";
$contents = 'My content';
$result = $this->Shell->createFile($file, $contents);
$this->assertFileExists($file);
$this->assertTextEquals('', file_get_contents($file));
@@ -556,7 +556,7 @@ public function testCreateFileOverwrite()
touch($file);
$this->assertFileExists($file);
$contents = "My content";
$contents = 'My content';
$result = $this->Shell->createFile($file, $contents);
$this->assertFileExists($file);
$this->assertTextEquals($contents, file_get_contents($file));
@@ -376,7 +376,7 @@ public function testWriteConfigKeyWithCustomEncryptionKey()
$name = 'sampleCookieTest';
$value = 'some data';
$encryption = 'aes';
$prefix = "Q2FrZQ==.";
$prefix = 'Q2FrZQ==.';
$key = 'justanotherencryptionkeyjustanotherencryptionkey';
$this->Cookie->configKey($name, compact('key', 'encryption'));
@@ -699,11 +699,11 @@ public function testCheckingSavedEmpty()
*/
public function testCheckKeyWithSpaces()
{
$this->Cookie->write('CookieComponent Test', "test");
$this->Cookie->write('CookieComponent Test', 'test');
$this->assertTrue($this->Cookie->check('CookieComponent Test'));
$this->Cookie->delete('CookieComponent Test');
$this->Cookie->write('CookieComponent Test.Test Case', "test");
$this->Cookie->write('CookieComponent Test.Test Case', 'test');
$this->assertTrue($this->Cookie->check('CookieComponent Test.Test Case'));
}
@@ -789,6 +789,6 @@ protected function _encrypt($value)
$value = $this->_implode($value);
}
return "Q2FrZQ==." . base64_encode(Security::encrypt($value, $this->Cookie->config('key')));
return 'Q2FrZQ==.' . base64_encode(Security::encrypt($value, $this->Cookie->config('key')));
}
}
@@ -453,14 +453,14 @@ public function testBeforeRenderEventCancelsRender()
public static function statusCodeProvider()
{
return [
[300, "Multiple Choices"],
[301, "Moved Permanently"],
[302, "Found"],
[303, "See Other"],
[304, "Not Modified"],
[305, "Use Proxy"],
[307, "Temporary Redirect"],
[403, "Forbidden"],
[300, 'Multiple Choices'],
[301, 'Moved Permanently'],
[302, 'Found'],
[303, 'See Other'],
[304, 'Not Modified'],
[305, 'Use Proxy'],
[307, 'Temporary Redirect'],
[403, 'Forbidden'],
];
}
@@ -249,11 +249,11 @@ public function testCheckingSavedEmpty()
*/
public function testCheckKeyWithSpaces()
{
$this->assertTrue(Configure::write('Configure Test', "test"));
$this->assertTrue(Configure::write('Configure Test', 'test'));
$this->assertTrue(Configure::check('Configure Test'));
Configure::delete('Configure Test');
$this->assertTrue(Configure::write('Configure Test.Test Case', "test"));
$this->assertTrue(Configure::write('Configure Test.Test Case', 'test'));
$this->assertTrue(Configure::check('Configure Test.Test Case'));
}
@@ -434,15 +434,15 @@ public function testCanUpdateClassMap()
'syslog' => 'Cake\Log\Engine\SyslogLog',
];
$result = TestLogStaticConfig::dsnClassMap();
$this->assertEquals($expected, $result, "The class map should match the class property");
$this->assertEquals($expected, $result, 'The class map should match the class property');
$expected = [
'console' => 'Special\EngineLog',
'file' => 'Cake\Log\Engine\FileLog',
'syslog' => 'Cake\Log\Engine\SyslogLog',
];
$result = TestLogStaticConfig::dsnClassMap(['console' => 'Special\EngineLog']);
$this->assertEquals($expected, $result, "Should be possible to change the map");
$this->assertEquals($expected, $result, 'Should be possible to change the map');
$expected = [
'console' => 'Special\EngineLog',
@@ -451,7 +451,7 @@ public function testCanUpdateClassMap()
'my' => 'Special\OtherLog'
];
$result = TestLogStaticConfig::dsnClassMap(['my' => 'Special\OtherLog']);
$this->assertEquals($expected, $result, "Should be possible to add to the map");
$this->assertEquals($expected, $result, 'Should be possible to add to the map');
}
/**
@@ -107,7 +107,7 @@ public function testConnectionConfigCustom()
$dsn = 'mysql:host=foo;port=3440;dbname=bar;charset=a-language';
$expected = $config;
$expected['init'][] = "SET time_zone = 'Antarctica'";
$expected['init'][] = "SET NAMES a-language";
$expected['init'][] = 'SET NAMES a-language';
$expected['flags'] += [
PDO::ATTR_PERSISTENT => false,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
@@ -120,7 +120,7 @@ public function testConnectionConfigCustom()
$connection->expects($this->at(0))->method('exec')->with('Execute this');
$connection->expects($this->at(1))->method('exec')->with('this too');
$connection->expects($this->at(2))->method('exec')->with("SET time_zone = 'Antarctica'");
$connection->expects($this->at(3))->method('exec')->with("SET NAMES a-language");
$connection->expects($this->at(3))->method('exec')->with('SET NAMES a-language');
$connection->expects($this->exactly(4))->method('exec');
$driver->expects($this->once())->method('_connect')
@@ -44,14 +44,14 @@ public function testArityMultiplePlainValues()
{
$f = new FunctionExpression('MyFunction', ['foo', 'bar']);
$binder = new ValueBinder;
$this->assertEquals("MyFunction(:param0, :param1)", $f->sql($binder));
$this->assertEquals('MyFunction(:param0, :param1)', $f->sql($binder));
$this->assertEquals('foo', $binder->bindings()[':param0']['value']);
$this->assertEquals('bar', $binder->bindings()[':param1']['value']);
$binder = new ValueBinder;
$f = new FunctionExpression('MyFunction', ['bar']);
$this->assertEquals("MyFunction(:param0)", $f->sql($binder));
$this->assertEquals('MyFunction(:param0)', $f->sql($binder));
$this->assertEquals('bar', $binder->bindings()[':param0']['value']);
}
@@ -64,7 +64,7 @@ public function testLiteralParams()
{
$binder = new ValueBinder;
$f = new FunctionExpression('MyFunction', ['foo' => 'literal', 'bar']);
$this->assertEquals("MyFunction(foo, :param0)", $f->sql($binder));
$this->assertEquals('MyFunction(foo, :param0)', $f->sql($binder));
}
/**
@@ -78,7 +78,7 @@ public function testFunctionNesting()
$binder = new ValueBinder;
$f = new FunctionExpression('MyFunction', ['foo', 'bar']);
$g = new FunctionExpression('Wrapper', ['bar' => 'literal', $f]);
$this->assertEquals("Wrapper(bar, (MyFunction(:param0, :param1)))", $g->sql($binder));
$this->assertEquals('Wrapper(bar, (MyFunction(:param0, :param1)))', $g->sql($binder));
}
/**
Oops, something went wrong.

0 comments on commit 228e9ca

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