Correct line length and indentation

This commit is contained in:
Simon Welsh 2014-03-30 19:37:54 +13:00
parent 6db96eac8f
commit 1d5706f15c
12 changed files with 74 additions and 60 deletions

View File

@ -108,7 +108,8 @@ class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider {
* *
* @return boolean Success * @return boolean Success
*/ */
public static function add_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1, $attributes = null) { public static function add_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1,
$attributes = null) {
// If a class is defined, then force the use of that as a code. This helps prevent menu item duplication // If a class is defined, then force the use of that as a code. This helps prevent menu item duplication
if($controllerClass) { if($controllerClass) {
$code = $controllerClass; $code = $controllerClass;
@ -238,7 +239,8 @@ class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider {
* *
* @return boolean Success * @return boolean Success
*/ */
public static function replace_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1, $attributes = null) { public static function replace_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1,
$attributes = null) {
$item = new CMSMenuItem($menuTitle, $url, $controllerClass, $priority); $item = new CMSMenuItem($menuTitle, $url, $controllerClass, $priority);
if($attributes) { if($attributes) {

View File

@ -471,8 +471,10 @@ abstract class Object {
/** /**
* Return TRUE if a class has a specified extension. * Return TRUE if a class has a specified extension.
* This supports backwards-compatible format (static Object::has_extension($requiredExtension)) and new format ($object->has_extension($class, $requiredExtension)) * This supports backwards-compatible format (static Object::has_extension($requiredExtension))
* @param string $classOrExtension if 1 argument supplied, the class name of the extension to check for; if 2 supplied, the class name to test * and new format ($object->has_extension($class, $requiredExtension))
* @param string $classOrExtension if 1 argument supplied, the class name of the extension to
* check for; if 2 supplied, the class name to test
* @param string $requiredExtension used only if 2 arguments supplied * @param string $requiredExtension used only if 2 arguments supplied
*/ */
public static function has_extension($classOrExtension, $requiredExtension = null) { public static function has_extension($classOrExtension, $requiredExtension = null) {

View File

@ -300,17 +300,17 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener {
} }
} }
/** /**
* Risky test. * Risky test.
* *
* @param PHPUnit_Framework_Test $test * @param PHPUnit_Framework_Test $test
* @param Exception $e * @param Exception $e
* @param float $time * @param float $time
* @since Method available since Release 3.8.0 * @since Method available since Release 3.8.0
*/ */
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) { public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
// Stub out to support PHPUnit 3.8 // Stub out to support PHPUnit 3.8
} }
/** /**
* Trys to get the original exception thrown by the test on failure/error * Trys to get the original exception thrown by the test on failure/error

View File

@ -47,15 +47,15 @@ class SilverStripeListener implements PHPUnit_Framework_TestListener {
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) { public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
} }
/** /**
* Risky test. * Risky test.
* *
* @param PHPUnit_Framework_Test $test * @param PHPUnit_Framework_Test $test
* @param Exception $e * @param Exception $e
* @param float $time * @param float $time
* @since Method available since Release 3.8.0 * @since Method available since Release 3.8.0
*/ */
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) { public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
// Stub out to support PHPUnit 3.8 // Stub out to support PHPUnit 3.8
} }
} }

View File

@ -62,15 +62,15 @@ class TeamCityListener implements PHPUnit_Framework_TestListener {
echo "##teamcity[testIgnored name='{$class}.{$test->getName()}' message='$message']\n"; echo "##teamcity[testIgnored name='{$class}.{$test->getName()}' message='$message']\n";
} }
/** /**
* Risky test. * Risky test.
* *
* @param PHPUnit_Framework_Test $test * @param PHPUnit_Framework_Test $test
* @param Exception $e * @param Exception $e
* @param float $time * @param float $time
* @since Method available since Release 3.8.0 * @since Method available since Release 3.8.0
*/ */
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) { public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
// Stub out to support PHPUnit 3.8 // Stub out to support PHPUnit 3.8
} }
} }

View File

@ -38,17 +38,17 @@ class SS_TestListener implements PHPUnit_Framework_TestListener {
$this->class->tearDownOnce(); $this->class->tearDownOnce();
} }
/** /**
* Risky test. * Risky test.
* *
* @param PHPUnit_Framework_Test $test * @param PHPUnit_Framework_Test $test
* @param Exception $e * @param Exception $e
* @param float $time * @param float $time
* @since Method available since Release 3.8.0 * @since Method available since Release 3.8.0
*/ */
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) { public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
// Stub out to support PHPUnit 3.8 // Stub out to support PHPUnit 3.8
} }
/** /**
* @param String Classname * @param String Classname

View File

@ -16,8 +16,8 @@ class GroupedList extends SS_ListDecorator {
$result = array(); $result = array();
foreach ($this->list as $item) { foreach ($this->list as $item) {
/* if $item is an Object, $index can be a method or a value, // if $item is an Object, $index can be a method or a value,
* if $item is an array, $index is used as the index */ // if $item is an array, $index is used as the index
$key = is_object($item) ? ($item->hasMethod($index) ? $item->$index() : $item->$index) : $item[$index]; $key = is_object($item) ? ($item->hasMethod($index) ? $item->$index() : $item->$index) : $item[$index];
if (array_key_exists($key, $result)) { if (array_key_exists($key, $result)) {

View File

@ -122,6 +122,7 @@ class CmsFormsContext extends BehatContext {
} }
} }
// @codingStandardsIgnoreStart
/** /**
* Checks formatting in the HTML field, by analyzing the HTML node surrounding * Checks formatting in the HTML field, by analyzing the HTML node surrounding
* the text for certain properties. * the text for certain properties.
@ -162,6 +163,7 @@ class CmsFormsContext extends BehatContext {
call_user_func($assertFn, 'text-align: right;', $matchedNode->getAttribute('style')); call_user_func($assertFn, 'text-align: right;', $matchedNode->getAttribute('style'));
} }
} }
// @codingStandardsIgnoreEnd
/** /**
* Selects the first textual match in the HTML editor. Does not support * Selects the first textual match in the HTML editor. Does not support

View File

@ -238,7 +238,8 @@ class ControllerTest extends FunctionalTest {
Controller::join_links("?a=1", "admin/crm", "?b=2", "MyForm?c=3")); Controller::join_links("?a=1", "admin/crm", "?b=2", "MyForm?c=3"));
// And duplicates are handled nicely // And duplicates are handled nicely
$this->assertEquals("admin/crm?foo=2&bar=3&baz=1", Controller::join_links("admin/crm?foo=1&bar=1&baz=1", "?foo=2&bar=3")); $this->assertEquals("admin/crm?foo=2&bar=3&baz=1",
Controller::join_links("admin/crm?foo=1&bar=1&baz=1", "?foo=2&bar=3"));
$this->assertEquals ( $this->assertEquals (
'admin/action', Controller::join_links('admin/', '/', '/action'), 'Test that multiple slashes are trimmed.' 'admin/action', Controller::join_links('admin/', '/', '/action'), 'Test that multiple slashes are trimmed.'

View File

@ -358,9 +358,12 @@ class RequirementsTest extends SapphireTest {
$template = '<html><head></head><body><header>My header</header><p>Body<script></script></p></body></html>'; $template = '<html><head></head><body><header>My header</header><p>Body<script></script></p></body></html>';
// The expected outputs // The expected outputs
$JsInHead = "<html><head><script type=\"text/javascript\" src=\"http://www.mydomain.com/test.js\"></script>\n</head><body><header>My header</header><p>Body<script></script></p></body></html>"; $JsInHead = "<html><head><script type=\"text/javascript\" src=\"http://www.mydomain.com/test.js\">"
$JsInBody = "<html><head></head><body><header>My header</header><p>Body<script type=\"text/javascript\" src=\"http://www.mydomain.com/test.js\"></script><script></script></p></body></html>"; . "</script>\n</head><body><header>My header</header><p>Body<script></script></p></body></html>";
$JsAtEnd = "<html><head></head><body><header>My header</header><p>Body<script></script></p><script type=\"text/javascript\" src=\"http://www.mydomain.com/test.js\"></script></body></html>"; $JsInBody = "<html><head></head><body><header>My header</header><p>Body<script type=\"text/javascript\""
. " src=\"http://www.mydomain.com/test.js\"></script><script></script></p></body></html>";
$JsAtEnd = "<html><head></head><body><header>My header</header><p>Body<script></script></p><script "
. "type=\"text/javascript\" src=\"http://www.mydomain.com/test.js\"></script></body></html>";
// Test if the script is before the head tag, not before the body. // Test if the script is before the head tag, not before the body.

View File

@ -30,11 +30,15 @@ class GridFieldSortableHeaderTest extends SapphireTest {
// Check that the output shows name and hat as sortable fields, but not city // Check that the output shows name and hat as sortable fields, but not city
$this->assertContains('<span class="non-sortable">City</span>', $htmlFragment['header']); $this->assertContains('<span class="non-sortable">City</span>', $htmlFragment['header']);
$this->assertContains('value="Name" class="action ss-gridfield-sort" id="action_SetOrderName"', $htmlFragment['header']); $this->assertContains('value="Name" class="action ss-gridfield-sort" id="action_SetOrderName"',
$this->assertContains('value="Cheerleader Hat" class="action ss-gridfield-sort" id="action_SetOrderCheerleader-Hat-Colour"', $htmlFragment['header']); $htmlFragment['header']);
$this->assertContains(
'value="Cheerleader Hat" class="action ss-gridfield-sort" id="action_SetOrderCheerleader-Hat-Colour"',
$htmlFragment['header']);
// Check inverse of above // Check inverse of above
$this->assertNotContains('value="City" class="action ss-gridfield-sort" id="action_SetOrderCity"', $htmlFragment['header']); $this->assertNotContains('value="City" class="action ss-gridfield-sort" id="action_SetOrderCity"',
$htmlFragment['header']);
$this->assertNotContains('<span class="non-sortable">Name</span>', $htmlFragment['header']); $this->assertNotContains('<span class="non-sortable">Name</span>', $htmlFragment['header']);
$this->assertNotContains('<span class="non-sortable">Cheerleader Hat</span>', $htmlFragment['header']); $this->assertNotContains('<span class="non-sortable">Cheerleader Hat</span>', $htmlFragment['header']);
} }
@ -143,4 +147,4 @@ class GridFieldSortableHeaderTest_CheerleaderHat extends DataObject implements T
'Cheerleader' => 'GridFieldSortableHeaderTest_Cheerleader' 'Cheerleader' => 'GridFieldSortableHeaderTest_Cheerleader'
); );
} }

View File

@ -742,7 +742,7 @@ class SSViewer {
* </code> * </code>
*/ */
public function __construct($templateList, TemplateParser $parser = null) { public function __construct($templateList, TemplateParser $parser = null) {
$this->setParser($parser ?: Injector::inst()->get('SSTemplateParser')); $this->setParser($parser ?: Injector::inst()->get('SSTemplateParser'));
// flush template manifest cache if requested // flush template manifest cache if requested
if (isset($_GET['flush']) && $_GET['flush'] == 'all') { if (isset($_GET['flush']) && $_GET['flush'] == 'all') {
@ -1172,7 +1172,7 @@ class SSViewer_FromString extends SSViewer {
protected $content; protected $content;
public function __construct($content, TemplateParser $parser = null) { public function __construct($content, TemplateParser $parser = null) {
$this->setParser($parser ?: Injector::inst()->get('SSTemplateParser')); $this->setParser($parser ?: Injector::inst()->get('SSTemplateParser'));
$this->content = $content; $this->content = $content;
} }