Correct line length and indentation

This commit is contained in:
Simon Welsh 2013-08-21 21:27:16 +12:00
parent 2c0d03b2d6
commit c66cc952d2
7 changed files with 44 additions and 38 deletions

View File

@ -4,20 +4,20 @@
* @subpackage testing * @subpackage testing
*/ */
class BehatFixtureFactory extends \FixtureFactory { class BehatFixtureFactory extends \FixtureFactory {
public function createObject($name, $identifier, $data = null) { public function createObject($name, $identifier, $data = null) {
if(!$data) $data = array(); if(!$data) $data = array();
// Copy identifier to some visible property unless its already defined. // Copy identifier to some visible property unless its already defined.
// Exclude files, since they generate their own named based on the file path. // Exclude files, since they generate their own named based on the file path.
if(!$name != 'File' && !is_subclass_of($name, 'File')) { if(!$name != 'File' && !is_subclass_of($name, 'File')) {
foreach(array('Name', 'Title') as $fieldName) { foreach(array('Name', 'Title') as $fieldName) {
if(singleton($name)->hasField($fieldName) && !isset($data[$fieldName])) { if(singleton($name)->hasField($fieldName) && !isset($data[$fieldName])) {
$data[$fieldName] = $identifier; $data[$fieldName] = $identifier;
break; break;
} }
} }
} }
return parent::createObject($name, $identifier, $data); return parent::createObject($name, $identifier, $data);
} }
} }

View File

@ -62,7 +62,9 @@ class CheckboxField_Readonly extends ReadonlyField {
} }
public function Value() { public function Value() {
return Convert::raw2xml($this->value ? _t('CheckboxField.YESANSWER', 'Yes') : _t('CheckboxField.NOANSWER', 'No')); return Convert::raw2xml($this->value ?
_t('CheckboxField.YESANSWER', 'Yes') :
_t('CheckboxField.NOANSWER', 'No'));
} }
} }

View File

@ -1136,7 +1136,7 @@ abstract class SS_Query implements Iterator {
$result .= "<tr>"; $result .= "<tr>";
foreach($record as $k => $v) { foreach($record as $k => $v) {
$result .= "<th>" . Convert::raw2xml($k) . "</th> "; $result .= "<th>" . Convert::raw2xml($k) . "</th> ";
} }
$result .= "</tr> \n"; $result .= "</tr> \n";
} }
@ -1213,7 +1213,7 @@ abstract class SS_Query implements Iterator {
*/ */
public function valid() { public function valid() {
if(!$this->queryHasBegun) $this->next(); if(!$this->queryHasBegun) $this->next();
return $this->currentRecord !== false; return $this->currentRecord !== false;
} }
/** /**

View File

@ -77,8 +77,8 @@ class Hierarchy extends DataExtension {
* @param int $nodeCountThreshold The lower bounds for the amount of nodes to mark. If set, the logic will expand * @param int $nodeCountThreshold The lower bounds for the amount of nodes to mark. If set, the logic will expand
* nodes until it eaches at least this number, and then stops. Root nodes will always * nodes until it eaches at least this number, and then stops. Root nodes will always
* show regardless of this settting. Further nodes can be lazy-loaded via ajax. * show regardless of this settting. Further nodes can be lazy-loaded via ajax.
* This isn't a hard limit. Example: On a value of 10, with 20 root nodes, each having * This isn't a hard limit. Example: On a value of 10, with 20 root nodes, each having 30
* 30 children, the actual node count will be 50 (all root nodes plus first expanded child). * children, the actual node count will be 50 (all root nodes plus first expanded child).
* *
* @return string * @return string
*/ */

View File

@ -31,7 +31,7 @@ class FeatureContext extends SilverStripeContext
* Initializes context. * Initializes context.
* Every scenario gets it's own context object. * Every scenario gets it's own context object.
* *
* @param array $parameters context parameters (set them up through behat.yml) * @param array $parameters context parameters (set them up through behat.yml)
*/ */
public function __construct(array $parameters) public function __construct(array $parameters)
{ {
@ -47,22 +47,22 @@ class FeatureContext extends SilverStripeContext
$this->useContext('FixtureContext', $fixtureContext); $this->useContext('FixtureContext', $fixtureContext);
// Use blueprints to set user name from identifier // Use blueprints to set user name from identifier
$factory = $fixtureContext->getFixtureFactory(); $factory = $fixtureContext->getFixtureFactory();
$blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member'); $blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member');
$blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) { $blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) {
if(!isset($data['FirstName'])) $data['FirstName'] = $identifier; if(!isset($data['FirstName'])) $data['FirstName'] = $identifier;
}); });
$factory->define('Member', $blueprint); $factory->define('Member', $blueprint);
} }
public function setMinkParameters(array $parameters) public function setMinkParameters(array $parameters)
{ {
parent::setMinkParameters($parameters); parent::setMinkParameters($parameters);
if(isset($parameters['files_path'])) { if(isset($parameters['files_path'])) {
$this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']); $this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']);
} }
} }
/** /**
* @return FixtureFactory * @return FixtureFactory

View File

@ -130,7 +130,8 @@ class HTTPTest extends SapphireTest {
// background-image // background-image
// Note that using /./ in urls is absolutely acceptable // Note that using /./ in urls is absolutely acceptable
$test->assertEquals( $test->assertEquals(
'<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">Content</div>', '<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">'.
'Content</div>',
HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>') HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>')
); );
@ -169,7 +170,8 @@ class HTTPTest extends SapphireTest {
// background // background
// Note that using /./ in urls is absolutely acceptable // Note that using /./ in urls is absolutely acceptable
$test->assertEquals( $test->assertEquals(
'<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>', '<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">'.
'SS Blog</div>',
HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>') HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>')
); );

View File

@ -22,11 +22,13 @@ class CoreTest extends SapphireTest {
$user = getTempFolderUsername(); $user = getTempFolderUsername();
// A typical Windows location for where sites are stored on IIS // A typical Windows location for where sites are stored on IIS
$this->assertEquals(sys_get_temp_dir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user, $this->assertEquals(sys_get_temp_dir() .
'/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user,
getTempFolder('C:\\inetpub\\wwwroot\\silverstripe-test-project')); getTempFolder('C:\\inetpub\\wwwroot\\silverstripe-test-project'));
// A typical Mac OS X location for where sites are stored // A typical Mac OS X location for where sites are stored
$this->assertEquals(sys_get_temp_dir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user, $this->assertEquals(sys_get_temp_dir() .
'/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user,
getTempFolder('/Users/joebloggs/Sites/silverstripe-test-project')); getTempFolder('/Users/joebloggs/Sites/silverstripe-test-project'));
// A typical Linux location for where sites are stored // A typical Linux location for where sites are stored