Completed
Branch AUTOMATED_TESTING (09d9f2)
by Gordon
13:24
created
code/LatLongField.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -19,6 +19,9 @@
 block discarded – undo
19 19
 
20 20
 	private static $ctr = 0;
21 21
 
22
+	/**
23
+	 * @param string[] $buttonText
24
+	 */
22 25
 	public function __construct($children = array(), $buttonText = null) {
23 26
 		self::$ctr++;
24 27
 
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -59,38 +59,38 @@
 block discarded – undo
59 59
 		Requirements::javascript(MAPPABLE_MODULE_PATH.'/javascript/mapField.js');
60 60
 
61 61
 		$attributes = array(
62
-            'class' => 'editableMap',
63
-            'id' => 'GoogleMap',
64
-            'data-LatFieldName' => $this->latField,
62
+			'class' => 'editableMap',
63
+			'id' => 'GoogleMap',
64
+			'data-LatFieldName' => $this->latField,
65 65
 			'data-LonFieldName' => $this->longField,
66 66
 			'data-ZoomFieldName' => $this->zoomField,
67 67
 			'data-UseMapBounds' => false
68
-       );
68
+	   );
69 69
 
70
-        Requirements::css('mappable/css/mapField.css');
71
-        $guidePointsJSON = '';
72
-        if (!empty($this->guidePoints)) {
73
-        	$latlongps = array();
70
+		Requirements::css('mappable/css/mapField.css');
71
+		$guidePointsJSON = '';
72
+		if (!empty($this->guidePoints)) {
73
+			$latlongps = array();
74 74
 
75 75
 			foreach ($this->guidePoints as $guidepoint) {
76 76
 				array_push($latlongps, $guidepoint);
77 77
 			}
78 78
 
79
-        	$guidePointsJSON = json_encode($latlongps);
80
-        	// convert the mappable guidepoints to lat lon
79
+			$guidePointsJSON = json_encode($latlongps);
80
+			// convert the mappable guidepoints to lat lon
81 81
 
82
-        	$attributes['data-GuidePoints'] = $guidePointsJSON;
82
+			$attributes['data-GuidePoints'] = $guidePointsJSON;
83 83
 
84
-        	// we only wish to change the bounds to those of all the points iff
85
-        	// the item currently has no location
86
-        	$attributes['data-useMapBounds'] = true;
87
-        }
88
-        $content = '<div class="editableMapWrapper">' . $this->createTag(
89
-            "div",
90
-            $attributes
91
-       ) . '</div>';
84
+			// we only wish to change the bounds to those of all the points iff
85
+			// the item currently has no location
86
+			$attributes['data-useMapBounds'] = true;
87
+		}
88
+		$content = '<div class="editableMapWrapper">' . $this->createTag(
89
+			"div",
90
+			$attributes
91
+	   ) . '</div>';
92 92
 
93
-        $this->FieldList()->push(new LiteralField('locationEditor', $content));
93
+		$this->FieldList()->push(new LiteralField('locationEditor', $content));
94 94
 
95 95
 		$content2 = <<<HTML
96 96
 <div id="mapSearch">
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class LatLongField extends FieldGroup {
4 4
 
5
-	private static $allowed_actions = array (
5
+	private static $allowed_actions = array(
6 6
 		'geocode'
7 7
 	);
8 8
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         	// the item currently has no location
86 86
         	$attributes['data-useMapBounds'] = true;
87 87
         }
88
-        $content = '<div class="editableMapWrapper">' . $this->createTag(
88
+        $content = '<div class="editableMapWrapper">'.$this->createTag(
89 89
             "div",
90 90
             $attributes
91
-       ) . '</div>';
91
+       ).'</div>';
92 92
 
93 93
         $this->FieldList()->push(new LiteralField('locationEditor', $content));
94 94
 
Please login to merge, or discard this patch.
code/MapField.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -10,6 +10,10 @@
 block discarded – undo
10 10
 		protected $headingLevel = 2;
11 11
 		private $divId;
12 12
 
13
+		/**
14
+		 * @param string $name
15
+		 * @param string $title
16
+		 */
13 17
 		function __construct($name, $title = null, $headingLevel = 2, $allowHTML = false, $form = null) {
14 18
 			$this->divId = $name;
15 19
 				// legacy handling for old parameters: $title, $heading, ...
Please login to merge, or discard this patch.
code/MapUtil.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,6 +79,9 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 
81 81
 
82
+	/**
83
+	 * @param boolean $new_map_already_rendered
84
+	 */
82 85
 	public static function set_map_already_rendered($new_map_already_rendered) {
83 86
 		self::$map_already_rendered = $new_map_already_rendered;
84 87
 	}
@@ -155,7 +158,7 @@  discard block
 block discarded – undo
155 158
 	/**
156 159
 	 * Get a new GoogleMapAPI object and load it with the default settings
157 160
 	 *
158
-	 * @return GoogleMapAPI
161
+	 * @return MapAPI
159 162
 	 */
160 163
 	public static function instance()
161 164
 	{
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 
149
-	public function set_icon_size($iconWidth,$iconHeight)
149
+	public function set_icon_size($iconWidth, $iconHeight)
150 150
 	{
151 151
 		self::$iconWidth = $iconWidth;
152 152
 		self::$iconHeight = $iconHeight;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @return string
209 209
 	 */
210 210
 	public static function sanitize($content) {
211
-		return addslashes(str_replace(array("\n","\r", "\t"), '' ,$content));
211
+		return addslashes(str_replace(array("\n", "\r", "\t"), '', $content));
212 212
 	}
213 213
 
214 214
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public static function get_map(SS_List $list, $infowindowtemplateparams) {
225 225
 		$gmap = self::instance();
226
-		if($list) {
226
+		if ($list) {
227 227
 			foreach ($list as $mappable) {
228 228
 				if (self::ChooseToAddDataobject($mappable)) {
229 229
 					$gmap->addMarkerAsObject($mappable, $infowindowtemplateparams);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	private static function ChooseToAddDataobject(DataObject $do) {
245 245
 		$isMappable = $do->is_a('Mappable');
246 246
 
247
-		foreach($do->getExtensionInstances() as $extension) {
247
+		foreach ($do->getExtensionInstances() as $extension) {
248 248
 			$isMappable = $isMappable || $extension instanceof Mappable;
249 249
 		}
250 250
 
@@ -252,6 +252,6 @@  discard block
 block discarded – undo
252 252
 			? $do->MapPinEdited
253 253
 			: true;
254 254
 
255
-		return $isMappable && $filterMapPinEdited  ;
255
+		return $isMappable && $filterMapPinEdited;
256 256
 	}
257 257
 }
Please login to merge, or discard this patch.
tests/MapFieldTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 	public function testFieldWithTitle() {
6 6
 		//$headingLevel = 2, $allowHTML = false, $form = nul
7
-		$field = new MapField('NameOfField','TitleOfField');
7
+		$field = new MapField('NameOfField', 'TitleOfField');
8 8
 		$expected = '<div class="editableMap"><div class="middleColumn" id="Nam'
9 9
 				  . 'eOfField" style="width:100%;height:300px;margin:5px 0px 5p'
10 10
 				  . 'x 5px;position:relative;"></div></div>';
Please login to merge, or discard this patch.
tests/MapUtilTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	public function test_set_map_size() {
35
-		MapUtil::set_map_size('890px','24em');
35
+		MapUtil::set_map_size('890px', '24em');
36 36
 		$html = $this->htmlForMap();
37 37
 		$this->assertContains(' style="width:890px; height: 24em;"', $html);
38 38
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$member->Lon = 29.24;
80 80
 		$list = new ArrayList();
81 81
 		$list->push($member);
82
-		$map = MapUtil::get_map($list,array());
82
+		$map = MapUtil::get_map($list, array());
83 83
 		$html = $map->forTemplate();
84 84
 		echo $html;
85 85
 		$this->fail('No change observed in generated HTML');
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	private function htmlForMap() {
90
-		$map = MapUtil::get_map(new ArrayList(),array());
90
+		$map = MapUtil::get_map(new ArrayList(), array());
91 91
 		$html = $map->forTemplate();
92 92
 		return $html;
93 93
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$this->fail('No evidence of map type changing');
109 109
 	}
110 110
 
111
-	 public function test_set_info_window_width()  {
111
+	 public function test_set_info_window_width() {
112 112
 	 	$this->fail('No evidence of set info width being used');
113 113
 	}
114 114
 
Please login to merge, or discard this patch.