From dde90dc346072383ff4a3312c3b612dc633a2f73 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Sun, 30 Mar 2014 19:51:38 +1300 Subject: [PATCH] Correct line length and endings --- core/manifest/ConfigStaticManifest.php | 3 +- email/Mailer.php | 3 +- model/Image.php | 6 ++-- tests/control/RequestHandlingTest.php | 12 +++---- tests/forms/EnumFieldTest.php | 38 ++++++++++----------- tests/forms/uploadfield/UploadFieldTest.php | 4 ++- tests/model/ImageTest.php | 18 ++++++---- 7 files changed, 48 insertions(+), 36 deletions(-) diff --git a/core/manifest/ConfigStaticManifest.php b/core/manifest/ConfigStaticManifest.php index 79885cd0d..e0beb5576 100644 --- a/core/manifest/ConfigStaticManifest.php +++ b/core/manifest/ConfigStaticManifest.php @@ -286,7 +286,8 @@ class SS_ConfigStaticManifest_Parser { // NOP } else { - user_error('Unexpected token ("' . token_name($type) . '") when building static manifest in class "' . $class . '": '.print_r($token, true), E_USER_ERROR); + user_error('Unexpected token ("' . token_name($type) . '") when building static manifest in class "' + . $class . '": '.print_r($token, true), E_USER_ERROR); } } diff --git a/email/Mailer.php b/email/Mailer.php index 37f7bc885..36a2955e4 100644 --- a/email/Mailer.php +++ b/email/Mailer.php @@ -224,7 +224,8 @@ class Mailer extends Object { $to = $this->validEmailAddr($to); // Try it without the -f option if it fails - if(!$bounceAddress || !($result = @mail($to, $subject, $fullBody, $headers, escapeshellarg("-f$bounceAddress")))) { + if(!$bounceAddress || + !($result = @mail($to, $subject, $fullBody, $headers, escapeshellarg("-f$bounceAddress")))) { $result = mail($to, $subject, $fullBody, $headers); } diff --git a/model/Image.php b/model/Image.php index 50f5240a0..19a614ad0 100644 --- a/model/Image.php +++ b/model/Image.php @@ -446,7 +446,8 @@ class Image extends File { $filename = $format . "-" . $this->Name; $patterns = $this->getFilenamePatterns($this->Name); if (!preg_match($patterns['FullPattern'], $filename)) { - throw new InvalidArgumentException('Filename ' . $filename . ' that should be used to cache a resized image is invalid'); + throw new InvalidArgumentException('Filename ' . $filename + . ' that should be used to cache a resized image is invalid'); } return $folder . "_resampled/" . $filename; @@ -564,7 +565,8 @@ class Image extends File { $generateFuncs = implode('|', $generateFuncs); $base64Match = "[a-zA-Z0-9\/\r\n+]*={0,2}"; return array( - 'FullPattern' => "/^((?P{$generateFuncs})(?P" . $base64Match . ")\-)+" . preg_quote($filename) . "$/i", + 'FullPattern' => "/^((?P{$generateFuncs})(?P" . $base64Match . ")\-)+" + . preg_quote($filename) . "$/i", 'GeneratorPattern' => "/(?P{$generateFuncs})(?P" . $base64Match . ")\-/i" ); } diff --git a/tests/control/RequestHandlingTest.php b/tests/control/RequestHandlingTest.php index 0b9cdfd05..dd189c658 100644 --- a/tests/control/RequestHandlingTest.php +++ b/tests/control/RequestHandlingTest.php @@ -11,16 +11,16 @@ class RequestHandlingTest extends FunctionalTest { parent::setUp(); Config::inst()->update('Director', 'rules', array( - // If we don't request any variables, then the whole URL will get shifted off. This is fine, but it means that the - // controller will have to parse the Action from the URL itself. + // If we don't request any variables, then the whole URL will get shifted off. + // This is fine, but it means that the controller will have to parse the Action from the URL itself. 'testGoodBase1' => "RequestHandlingTest_Controller", - // The double-slash indicates how much of the URL should be shifted off the stack. This is important for dealing - // with nested request handlers appropriately. + // The double-slash indicates how much of the URL should be shifted off the stack. + // This is important for dealing with nested request handlers appropriately. 'testGoodBase2//$Action/$ID/$OtherID' => "RequestHandlingTest_Controller", - // By default, the entire URL will be shifted off. This creates a bit of backward-incompatability, but makes the - // URL rules much more explicit. + // By default, the entire URL will be shifted off. This creates a bit of + // backward-incompatability, but makes the URL rules much more explicit. 'testBadBase/$Action/$ID/$OtherID' => "RequestHandlingTest_Controller", // Rules with an extension always default to the index() action diff --git a/tests/forms/EnumFieldTest.php b/tests/forms/EnumFieldTest.php index e18d7ed23..d666a6dff 100644 --- a/tests/forms/EnumFieldTest.php +++ b/tests/forms/EnumFieldTest.php @@ -1,19 +1,19 @@ - 'Value' - ); - $enumField = new Enum('testField', $values); - - $searchField = $enumField->scaffoldSearchField(); - - $anyText = "(" . _t('Enum.ANY', 'Any') . ")"; - $this->assertEquals(true, $searchField->getHasEmptyDefault()); - $this->assertEquals($anyText, $searchField->getEmptyString()); - } -} \ No newline at end of file + 'Value' + ); + $enumField = new Enum('testField', $values); + + $searchField = $enumField->scaffoldSearchField(); + + $anyText = "(" . _t('Enum.ANY', 'Any') . ")"; + $this->assertEquals(true, $searchField->getHasEmptyDefault()); + $this->assertEquals($anyText, $searchField->getEmptyString()); + } +} diff --git a/tests/forms/uploadfield/UploadFieldTest.php b/tests/forms/uploadfield/UploadFieldTest.php index 0510ac059..eb5849c07 100644 --- a/tests/forms/uploadfield/UploadFieldTest.php +++ b/tests/forms/uploadfield/UploadFieldTest.php @@ -598,7 +598,9 @@ class UploadFieldTest extends FunctionalTest { ), 'Removes dropzone'); $this->assertTrue( - (bool)$parser->getBySelector('#UploadFieldTestForm_Form_CanUploadFalseField_Holder .ss-uploadfield-fromfiles'), + (bool)$parser->getBySelector( + '#UploadFieldTestForm_Form_CanUploadFalseField_Holder .ss-uploadfield-fromfiles' + ), 'Keeps "From files" button' ); } diff --git a/tests/model/ImageTest.php b/tests/model/ImageTest.php index 9ca835e1d..8b782fec5 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -215,18 +215,22 @@ class ImageTest extends SapphireTest { // Encoding of the arguments is duplicated from cacheFilename $argumentString = base64_encode(json_encode(array(600,600,'0F0F0F'))); $this->assertNotNull($imageThird); - $this->assertContains($argumentString, $imageThird->getFullPath(), 'Image contains background color for padded resizement'); + $this->assertContains($argumentString, $imageThird->getFullPath(), + 'Image contains background color for padded resizement'); $imageThirdPath = $imageThird->getFullPath(); $filesInFolder = $folder->find(dirname($imageThirdPath)); - $this->assertEquals(3, count($filesInFolder), 'Image folder contains only the expected number of images before regeneration'); + $this->assertEquals(3, count($filesInFolder), + 'Image folder contains only the expected number of images before regeneration'); $hash = md5_file($imageThirdPath); - $this->assertEquals(3, $image->regenerateFormattedImages(), 'Cached images were regenerated in the right number'); + $this->assertEquals(3, $image->regenerateFormattedImages(), + 'Cached images were regenerated in the right number'); $this->assertEquals($hash, md5_file($imageThirdPath), 'Regeneration of third image is correct'); /* Check that no other images exist, to ensure that the regeneration did not create other images */ - $this->assertEquals($filesInFolder, $folder->find(dirname($imageThirdPath)), 'Image folder contains only the expected image files after regeneration'); + $this->assertEquals($filesInFolder, $folder->find(dirname($imageThirdPath)), + 'Image folder contains only the expected image files after regeneration'); } public function testRegenerateImages() { @@ -235,7 +239,8 @@ class ImageTest extends SapphireTest { $p = $image_generated->getFullPath(); $this->assertTrue(file_exists($p), 'Resized image exists after creation call'); $this->assertEquals(1, $image->regenerateFormattedImages(), 'Cached images were regenerated correct'); - $this->assertEquals($image_generated->getWidth(), 200, 'Resized image has correct width after regeneration call'); + $this->assertEquals($image_generated->getWidth(), 200, + 'Resized image has correct width after regeneration call'); $this->assertTrue(file_exists($p), 'Resized image exists after regeneration call'); } @@ -254,7 +259,8 @@ class ImageTest extends SapphireTest { rename($p, $newPath); $this->assertFalse(file_exists($p), 'Resized image does not exist after movement call under old name'); $this->assertTrue(file_exists($newPath), 'Resized image exists after movement call under new name'); - $this->assertEquals(1, $image->regenerateFormattedImages(), 'Cached images were regenerated in the right number'); + $this->assertEquals(1, $image->regenerateFormattedImages(), + 'Cached images were regenerated in the right number'); $image_generated_2 = new Image_Cached($newRelative); $this->assertEquals(300, $image_generated_2->getWidth(), 'Cached image was regenerated with correct width');