Passed
Push — 1.10.x ( 632c63...98cf05 )
by Yannick
382:30 queued 334:53
created
plugin/pens/lib/pens/pens_package_handler.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
  * along with php-pens.  If not, see <http://www.gnu.org/licenses/>.
17 17
  */
18 18
  
19
- /**
20
- * PENSPackageHandler
21
- * 
22
- * Provides the PENSPackageHandler abstract class
23
- * 
24
- * @package PENS
25
- * @author Guillaume Viguier-Just <[email protected]>
26
- * @licence http://www.gnu.org/licenses/gpl.txt
27
- */
19
+    /**
20
+     * PENSPackageHandler
21
+     * 
22
+     * Provides the PENSPackageHandler abstract class
23
+     * 
24
+     * @package PENS
25
+     * @author Guillaume Viguier-Just <[email protected]>
26
+     * @licence http://www.gnu.org/licenses/gpl.txt
27
+     */
28 28
 
29 29
 require_once(dirname(__FILE__)."/pens_config.php");
30 30
 
@@ -39,76 +39,76 @@  discard block
 block discarded – undo
39 39
  * @licence http://www.gnu.org/licenses/gpl.txt
40 40
  */
41 41
 abstract class PENSPackageHandler {
42
-	/**
43
-	 * Array of supported package types for this handler. Set by default to PENSConfig::$allowed_package_types
44
-	 * @var array
45
-	 */
46
-	protected $_supported_package_types = null;
42
+    /**
43
+     * Array of supported package types for this handler. Set by default to PENSConfig::$allowed_package_types
44
+     * @var array
45
+     */
46
+    protected $_supported_package_types = null;
47 47
 	
48
-	/**
49
-	 * Array of supported package formats for this handler. Set by default to PENSConfig::$allowed_package_formats
50
-	 * @var array
51
-	 */
52
-	protected $_supported_package_formats = null;
48
+    /**
49
+     * Array of supported package formats for this handler. Set by default to PENSConfig::$allowed_package_formats
50
+     * @var array
51
+     */
52
+    protected $_supported_package_formats = null;
53 53
 	
54
-	/**
55
-	 * Constructor. Sets the default values of supported_package_types and supported_package_formats
56
-	 */
57
-	public function __construct() {
58
-		$this->_supported_package_types = PENSConfig::$allowed_package_types;
59
-		$this->_supported_package_formats = PENSConfig::$allowed_package_formats;
60
-	}
54
+    /**
55
+     * Constructor. Sets the default values of supported_package_types and supported_package_formats
56
+     */
57
+    public function __construct() {
58
+        $this->_supported_package_types = PENSConfig::$allowed_package_types;
59
+        $this->_supported_package_formats = PENSConfig::$allowed_package_formats;
60
+    }
61 61
 	
62
-	public function getSupportedPackageTypes() {
63
-		return $this->_supported_package_types;
64
-	}
62
+    public function getSupportedPackageTypes() {
63
+        return $this->_supported_package_types;
64
+    }
65 65
 	
66
-	/**
67
-	 * Sets the supported package types. All package types in the array provided as an argument
68
-	 * not present in PENSConfig::$allowed_package_types will be ignored. The supported_package_types
69
-	 * will be set to null if the argument given is not an array
70
-	 * 
71
-	 * @param array Supported package types
72
-	 */
73
-	public function setSupportedPackageTypes($supported_package_types) {
74
-		$this->_supported_package_types = null;
75
-		if(is_array($supported_package_types)) {
76
-			foreach($supported_package_types as $package_type) {
77
-				if(in_array($package_type, PENSConfig::$allowed_package_types)) {
78
-					$this->_supported_package_types[] = $package_type;
79
-				}
80
-			}
81
-		}
82
-	}
66
+    /**
67
+     * Sets the supported package types. All package types in the array provided as an argument
68
+     * not present in PENSConfig::$allowed_package_types will be ignored. The supported_package_types
69
+     * will be set to null if the argument given is not an array
70
+     * 
71
+     * @param array Supported package types
72
+     */
73
+    public function setSupportedPackageTypes($supported_package_types) {
74
+        $this->_supported_package_types = null;
75
+        if(is_array($supported_package_types)) {
76
+            foreach($supported_package_types as $package_type) {
77
+                if(in_array($package_type, PENSConfig::$allowed_package_types)) {
78
+                    $this->_supported_package_types[] = $package_type;
79
+                }
80
+            }
81
+        }
82
+    }
83 83
 	
84
-	public function getSupportedPackageFormats() {
85
-		return $this->_supported_package_formats;
86
-	}
84
+    public function getSupportedPackageFormats() {
85
+        return $this->_supported_package_formats;
86
+    }
87 87
 	
88
-	/**
89
-	 * Sets the supported package formats. All package types in the array provided as an argument
90
-	 * not present in PENSConfig::$allowed_package_formats will be ignored. The supported_package_formats
91
-	 * will be set to null if the argument given is not an array.
92
-	 * 
93
-	 * @param array Supported package formats
94
-	 */
95
-	public function setSupportedPackageFormats($supported_package_formats) {
96
-		$this->_supported_package_formats = null;
97
-		if(is_array($supported_package_formats)) {
98
-			foreach($supported_package_formats as $package_format) {
99
-				if(in_array($package_format, PENSConfig::$allowed_package_formats)) {
100
-					$this->_supported_package_formats[] = $package_format;
101
-				}
102
-			}
103
-		}
104
-	}
88
+    /**
89
+     * Sets the supported package formats. All package types in the array provided as an argument
90
+     * not present in PENSConfig::$allowed_package_formats will be ignored. The supported_package_formats
91
+     * will be set to null if the argument given is not an array.
92
+     * 
93
+     * @param array Supported package formats
94
+     */
95
+    public function setSupportedPackageFormats($supported_package_formats) {
96
+        $this->_supported_package_formats = null;
97
+        if(is_array($supported_package_formats)) {
98
+            foreach($supported_package_formats as $package_format) {
99
+                if(in_array($package_format, PENSConfig::$allowed_package_formats)) {
100
+                    $this->_supported_package_formats[] = $package_format;
101
+                }
102
+            }
103
+        }
104
+    }
105 105
 	
106
-	/**
107
-	 * Processes the package. Must be implemented by subclasses
108
-	 * 
109
-	 * @param PENSRequestCollect Collect request sent by the client
110
-	 * @param string Path to the collected package on the hard drive
111
-	 */
112
-	abstract public function processPackage($request, $path_to_package);
106
+    /**
107
+     * Processes the package. Must be implemented by subclasses
108
+     * 
109
+     * @param PENSRequestCollect Collect request sent by the client
110
+     * @param string Path to the collected package on the hard drive
111
+     */
112
+    abstract public function processPackage($request, $path_to_package);
113 113
 	
114 114
 }
Please login to merge, or discard this patch.
plugin/pens/lib/pens/pens_request_handler.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
  * along with php-pens.  If not, see <http://www.gnu.org/licenses/>.
17 17
  */
18 18
  
19
- /**
20
- * PENSRequestHandler
21
- * 
22
- * Provides the PENSRequestHandler abstract class
23
- * 
24
- * @package PENS
25
- * @author Guillaume Viguier-Just <[email protected]>
26
- * @licence http://www.gnu.org/licenses/gpl.txt
27
- */
19
+    /**
20
+     * PENSRequestHandler
21
+     * 
22
+     * Provides the PENSRequestHandler abstract class
23
+     * 
24
+     * @package PENS
25
+     * @author Guillaume Viguier-Just <[email protected]>
26
+     * @licence http://www.gnu.org/licenses/gpl.txt
27
+     */
28 28
 
29 29
 /**
30 30
  * PENSRequestHandler
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
  * @licence http://www.gnu.org/licenses/gpl.txt
38 38
  */
39 39
 abstract class PENSRequestHandler {
40
-	/**
41
-	 * Processes the request. Must be implemented by subclasses
42
-	 * 
43
-	 * @param PENSRequest Alert or Receipt request sent by the server
44
-	 * @param PENSResponse Response sent by the server (error, error-text etc...)
45
-	 */
46
-	abstract public function processRequest($request, $response);
40
+    /**
41
+     * Processes the request. Must be implemented by subclasses
42
+     * 
43
+     * @param PENSRequest Alert or Receipt request sent by the server
44
+     * @param PENSResponse Response sent by the server (error, error-text etc...)
45
+     */
46
+    abstract public function processRequest($request, $response);
47 47
 }
48 48
 
Please login to merge, or discard this patch.
plugin/pens/lib/pens/pens_request_receipt.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
 
41 41
 class PENSRequestReceipt extends PENSRequest {
42 42
 	
43
-	public function __construct($arguments) {
44
-		parent::__construct($arguments);
45
-		$this->setCommand("receipt");
46
-	}
43
+    public function __construct($arguments) {
44
+        parent::__construct($arguments);
45
+        $this->setCommand("receipt");
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
plugin/pens/lib/pens/pens_request_factory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -43,26 +43,26 @@
 block discarded – undo
43 43
  */
44 44
 class PENSRequestFactory {
45 45
 
46
-	/**
47
-	 * Factory method
48
-	 * 
49
-	 * Creates the right PENSRequest object, based on the command inside the arguments
50
-	 * 
51
-	 * @param array Associative array of arguments
52
-	 * @return mixed PENSRequestAlert or PENSRequestCollect or PENSRequestReceipt
53
-	 * 
54
-	 * @throws PENSException with code 2002 if command is invalid
55
-	 */
56
-	public static function createPENSRequest($arguments) {
57
-		$command = $arguments["command"];
58
-		if($command == "alert") {
59
-			return new PENSRequestAlert($arguments);
60
-		} else if($command == "collect") {
61
-			return new PENSRequestCollect($arguments);
62
-		} else if($command == "receipt") {
63
-			return new PENSRequestReceipt($arguments);
64
-		} else {
65
-			throw new PENSException(2002);
66
-		}
67
-	}
46
+    /**
47
+     * Factory method
48
+     * 
49
+     * Creates the right PENSRequest object, based on the command inside the arguments
50
+     * 
51
+     * @param array Associative array of arguments
52
+     * @return mixed PENSRequestAlert or PENSRequestCollect or PENSRequestReceipt
53
+     * 
54
+     * @throws PENSException with code 2002 if command is invalid
55
+     */
56
+    public static function createPENSRequest($arguments) {
57
+        $command = $arguments["command"];
58
+        if($command == "alert") {
59
+            return new PENSRequestAlert($arguments);
60
+        } else if($command == "collect") {
61
+            return new PENSRequestCollect($arguments);
62
+        } else if($command == "receipt") {
63
+            return new PENSRequestReceipt($arguments);
64
+        } else {
65
+            throw new PENSException(2002);
66
+        }
67
+    }
68 68
 }
Please login to merge, or discard this patch.
plugin/pens/lib/pens/pens_response.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -39,137 +39,137 @@
 block discarded – undo
39 39
  * @author Guillaume Viguier-Just <[email protected]>
40 40
  * @licence http://www.gnu.org/licenses/gpl.txt
41 41
  */
42
- class PENSResponse extends PENSMessage {
43
-	 /**
44
-	  * Error code
45
-	  * @var int
46
-	  */
47
-	 protected $_error = null;
42
+    class PENSResponse extends PENSMessage {
43
+        /**
44
+         * Error code
45
+         * @var int
46
+         */
47
+        protected $_error = null;
48 48
 	 
49
-	 /**
50
-	  * Descriptive text of the error
51
-	  * @var string
52
-	  */
53
-	 protected $_error_text = null;
49
+        /**
50
+         * Descriptive text of the error
51
+         * @var string
52
+         */
53
+        protected $_error_text = null;
54 54
 	 
55
-	 /**
56
-	  * Data linked to the error
57
-	  * @var string
58
-	  */
59
-	 protected $_pens_data = null;
55
+        /**
56
+         * Data linked to the error
57
+         * @var string
58
+         */
59
+        protected $_pens_data = null;
60 60
 	 
61
-	 /**
62
-	  * Version
63
-	  * @var string
64
-	  */
65
-	 protected $_pens_version = null;
61
+        /**
62
+         * Version
63
+         * @var string
64
+         */
65
+        protected $_pens_version = null;
66 66
 	 
67
-	 /**
68
-	  * Constructor
69
-	  * 
70
-	  * @param mixed Can be a PENSException or an error code or a string representing an HTTP response
71
-	  * @param string error text
72
-	  * @param string PENS data
73
-	  */
74
-	public function __construct($error, $error_text = null, $pens_data = null) {
75
-		$this->_pens_version = PENSConfig::$version;
76
-		if($error instanceof PENSException) {
77
-			$this->_error = $error->getCode();
78
-			$this->_error_text = $error->getMessage();
79
-		} else if(is_string($error)){
80
-			// Parse the string
81
-			$this->parseResponse($error);
82
-		} else if(is_array($error)) {
83
-			// Try to build from array
84
-			$this->_error = $error["error"];
85
-			$this->_error_text = $error["error-text"];
86
-			$this->_pens_data = $error["pens-data"];
87
-		} else {
88
-			$this->_error = $error;
89
-			$this->_error_text = $error_text;
90
-			$this->_pens_data = $pens_data;
91
-		}
67
+        /**
68
+         * Constructor
69
+         * 
70
+         * @param mixed Can be a PENSException or an error code or a string representing an HTTP response
71
+         * @param string error text
72
+         * @param string PENS data
73
+         */
74
+    public function __construct($error, $error_text = null, $pens_data = null) {
75
+        $this->_pens_version = PENSConfig::$version;
76
+        if($error instanceof PENSException) {
77
+            $this->_error = $error->getCode();
78
+            $this->_error_text = $error->getMessage();
79
+        } else if(is_string($error)){
80
+            // Parse the string
81
+            $this->parseResponse($error);
82
+        } else if(is_array($error)) {
83
+            // Try to build from array
84
+            $this->_error = $error["error"];
85
+            $this->_error_text = $error["error-text"];
86
+            $this->_pens_data = $error["pens-data"];
87
+        } else {
88
+            $this->_error = $error;
89
+            $this->_error_text = $error_text;
90
+            $this->_pens_data = $pens_data;
91
+        }
92 92
 		
93
-	}
93
+    }
94 94
 	
95
-	/**
96
-	 * Parses an HTTP response and assigns the attributes of the object
97
-	 * 
98
-	 * @param string HTTP response
99
-	 */
100
-	protected function parseResponse($response) {
101
-		$lines = explode(PENSConfig::$eol, $response);
102
-		$i = 1;
103
-		foreach($lines as $line) {
104
-			if($i < 5) {
105
-				$pair = explode("=", $line);
106
-				if($pair[0] == "error") {
107
-					$this->_error = intval($pair[1]);
108
-				} else if($pair[0] == "error-text") {
109
-					$this->_error_text = $pair[1];
110
-				} else if($pair[0] == "version") {
111
-					$this->_pens_version = $pair[1];
112
-				} else if($pair[0] == "pens-data") {
113
-					if(!empty($pair[1])) {
114
-						$this->_pens_data = $pair[1].PENSConfig::$eol;
115
-					}
116
-				}
117
-			} else {
118
-				if(!empty($line)) {
119
-					$this->_pens_data .= $line.PENSConfig::$eol;
120
-				}
121
-			}
122
-			$i++;
123
-		}
124
-	}
95
+    /**
96
+     * Parses an HTTP response and assigns the attributes of the object
97
+     * 
98
+     * @param string HTTP response
99
+     */
100
+    protected function parseResponse($response) {
101
+        $lines = explode(PENSConfig::$eol, $response);
102
+        $i = 1;
103
+        foreach($lines as $line) {
104
+            if($i < 5) {
105
+                $pair = explode("=", $line);
106
+                if($pair[0] == "error") {
107
+                    $this->_error = intval($pair[1]);
108
+                } else if($pair[0] == "error-text") {
109
+                    $this->_error_text = $pair[1];
110
+                } else if($pair[0] == "version") {
111
+                    $this->_pens_version = $pair[1];
112
+                } else if($pair[0] == "pens-data") {
113
+                    if(!empty($pair[1])) {
114
+                        $this->_pens_data = $pair[1].PENSConfig::$eol;
115
+                    }
116
+                }
117
+            } else {
118
+                if(!empty($line)) {
119
+                    $this->_pens_data .= $line.PENSConfig::$eol;
120
+                }
121
+            }
122
+            $i++;
123
+        }
124
+    }
125 125
 	
126
-	public function getError() {
127
-		return $this->_error;
128
-	}
126
+    public function getError() {
127
+        return $this->_error;
128
+    }
129 129
 	
130
-	public function getErrorText() {
131
-		return $this->_error_text;
132
-	}
130
+    public function getErrorText() {
131
+        return $this->_error_text;
132
+    }
133 133
 	
134
-	public function getPensData() {
135
-		return $this->_pens_data;
136
-	}
134
+    public function getPensData() {
135
+        return $this->_pens_data;
136
+    }
137 137
 	
138
-	public function getVersion() {
139
-		return $this->_pens_version;
140
-	}
138
+    public function getVersion() {
139
+        return $this->_pens_version;
140
+    }
141 141
 	
142
-	/**
143
-	 * Sends the response content through HTTP headers
144
-	 */
145
-	public function send() {
146
-		header("Content-Type: text/plain");
147
-		print $this;
148
-	}
142
+    /**
143
+     * Sends the response content through HTTP headers
144
+     */
145
+    public function send() {
146
+        header("Content-Type: text/plain");
147
+        print $this;
148
+    }
149 149
 	
150
-	/**
151
-	 * Returns an associative array of the response
152
-	 * 
153
-	 * @return array Associative array
154
-	 */
155
-	public function getArray() {
156
-		return array("error" => $this->_error,
157
-			"error-text" => $this->_error_text,
158
-			"version" => PENSConfig::$version,
159
-			"pens-data" => $this->_pens_data);
160
-	}
150
+    /**
151
+     * Returns an associative array of the response
152
+     * 
153
+     * @return array Associative array
154
+     */
155
+    public function getArray() {
156
+        return array("error" => $this->_error,
157
+            "error-text" => $this->_error_text,
158
+            "version" => PENSConfig::$version,
159
+            "pens-data" => $this->_pens_data);
160
+    }
161 161
 	
162
-	/**
163
-	 * Transforms the object into a string
164
-	 */
165
-	public function __toString() {
166
-		$eol = PENSConfig::$eol;
167
-		$return = "error=".$this->_error.$eol;
168
-		$return .= "error-text=".$this->_error_text.$eol;
169
-		$return .= "version=".PENSConfig::$version.$eol;
170
-		$return .= "pens-data=".$this->_pens_data.$eol;
171
-		return $return;
172
-	}
162
+    /**
163
+     * Transforms the object into a string
164
+     */
165
+    public function __toString() {
166
+        $eol = PENSConfig::$eol;
167
+        $return = "error=".$this->_error.$eol;
168
+        $return .= "error-text=".$this->_error_text.$eol;
169
+        $return .= "version=".PENSConfig::$version.$eol;
170
+        $return .= "pens-data=".$this->_pens_data.$eol;
171
+        return $return;
172
+    }
173 173
  
174
- }
174
+    }
175 175
  
Please login to merge, or discard this patch.
plugin/pens/lib/pens_client_test.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 require_once __DIR__ . '/pens.php';
27 27
 
28 28
 class MyRequestHandler extends PENSRequestHandler {
29
-	public function processRequest($request, $response) {
30
-		// Do the processing of the alert or the receipt here
31
-	}
29
+    public function processRequest($request, $response) {
30
+        // Do the processing of the alert or the receipt here
31
+    }
32 32
 }
33 33
 
34 34
 $handler = new MyRequestHandler();
Please login to merge, or discard this patch.
plugin/pens/lib/tests/test_pens_response.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,25 +44,25 @@
 block discarded – undo
44 44
  */
45 45
 class TestPENSResponse extends UnitTestCase {
46 46
 	
47
-	public function testCreationFromPENSException() {
48
-		$object = new PENSResponse(new PENSException(1101));
49
-		$this->assertEqual($object->getError(), 1101);
50
-		$this->assertNotNull($object->getErrorText());
51
-	}
47
+    public function testCreationFromPENSException() {
48
+        $object = new PENSResponse(new PENSException(1101));
49
+        $this->assertEqual($object->getError(), 1101);
50
+        $this->assertNotNull($object->getErrorText());
51
+    }
52 52
 	
53
-	public function testCreationFromArguments() {
54
-		$object = new PENSResponse(0, "collect command received and understood");
55
-		$this->assertIdentical($object->getError(), 0);
56
-		$this->assertEqual($object->getErrorText(), "collect command received and understood");
57
-	}
53
+    public function testCreationFromArguments() {
54
+        $object = new PENSResponse(0, "collect command received and understood");
55
+        $this->assertIdentical($object->getError(), 0);
56
+        $this->assertEqual($object->getErrorText(), "collect command received and understood");
57
+    }
58 58
 	
59
-	public function testCreationFromHTTPResponse() {
60
-		$eol = PENSConfig::$eol;
61
-		$response = "error=1101".$eol."error-text=unable to parse PENS command".$eol."version=1.0.0".$eol."pens-data=".$eol;
62
-		$object = new PENSResponse($response);
63
-		$this->assertIdentical($object->getError(), 1101);
64
-		$this->assertIdentical($object->getErrorText(), "unable to parse PENS command");
65
-		$this->assertIdentical($object->getVersion(), "1.0.0");
66
-		$this->assertNull($object->getPensData());
67
-	}
59
+    public function testCreationFromHTTPResponse() {
60
+        $eol = PENSConfig::$eol;
61
+        $response = "error=1101".$eol."error-text=unable to parse PENS command".$eol."version=1.0.0".$eol."pens-data=".$eol;
62
+        $object = new PENSResponse($response);
63
+        $this->assertIdentical($object->getError(), 1101);
64
+        $this->assertIdentical($object->getErrorText(), "unable to parse PENS command");
65
+        $this->assertIdentical($object->getVersion(), "1.0.0");
66
+        $this->assertNull($object->getPensData());
67
+    }
68 68
 }
Please login to merge, or discard this patch.
plugin/pens/lib/tests/test_pens_package_handler.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 require_once(dirname(__FILE__)."/../pens.php");
34 34
 
35 35
 class MyPackageHandler extends PENSPackageHandler {
36
-	public function processPackage($request, $path_to_package) {
37
-	}
36
+    public function processPackage($request, $path_to_package) {
37
+    }
38 38
 }
39 39
 
40 40
 /**
@@ -49,39 +49,39 @@  discard block
 block discarded – undo
49 49
  */
50 50
 class TestPENSPackageHandler extends UnitTestCase {
51 51
 	
52
-	public function testSupportedPackageTypesInvalid() {
53
-		$object = new MyPackageHandler();
54
-		$object->setSupportedPackageTypes("testing");
55
-		$this->assertEqual($object->getSupportedPackageTypes(), null);
56
-	}
52
+    public function testSupportedPackageTypesInvalid() {
53
+        $object = new MyPackageHandler();
54
+        $object->setSupportedPackageTypes("testing");
55
+        $this->assertEqual($object->getSupportedPackageTypes(), null);
56
+    }
57 57
 	
58
-	public function testSupportedPackageTypesInvalid2() {
59
-		$object = new MyPackageHandler();
60
-		$object->setSupportedPackageTypes(array("aicc-pkg", "testing"));
61
-		$this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg"));
62
-	}
58
+    public function testSupportedPackageTypesInvalid2() {
59
+        $object = new MyPackageHandler();
60
+        $object->setSupportedPackageTypes(array("aicc-pkg", "testing"));
61
+        $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg"));
62
+    }
63 63
 	
64
-	public function testSupportedPackageTypesValid() {
65
-		$object = new MyPackageHandler();
66
-		$object->setSupportedPackageTypes(array("aicc-pkg", "lms-qti"));
67
-		$this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg", "lms-qti"));
68
-	}
64
+    public function testSupportedPackageTypesValid() {
65
+        $object = new MyPackageHandler();
66
+        $object->setSupportedPackageTypes(array("aicc-pkg", "lms-qti"));
67
+        $this->assertEqual($object->getSupportedPackageTypes(), array("aicc-pkg", "lms-qti"));
68
+    }
69 69
 	
70
-	public function testSupportedPackageFormatsInvalid() {
71
-		$object = new MyPackageHandler();
72
-		$object->setSupportedPackageFormats("testing");
73
-		$this->assertEqual($object->getSupportedPackageFormats(), null);
74
-	}
70
+    public function testSupportedPackageFormatsInvalid() {
71
+        $object = new MyPackageHandler();
72
+        $object->setSupportedPackageFormats("testing");
73
+        $this->assertEqual($object->getSupportedPackageFormats(), null);
74
+    }
75 75
 	
76
-	public function testSupportedPackageFormatsInvalid2() {
77
-		$object = new MyPackageHandler();
78
-		$object->setSupportedPackageFormats(array("zip", "testing"));
79
-		$this->assertEqual($object->getSupportedPackageFormats(), array("zip"));
80
-	}
76
+    public function testSupportedPackageFormatsInvalid2() {
77
+        $object = new MyPackageHandler();
78
+        $object->setSupportedPackageFormats(array("zip", "testing"));
79
+        $this->assertEqual($object->getSupportedPackageFormats(), array("zip"));
80
+    }
81 81
 	
82
-	public function testSupportedPackageFormatsValid() {
83
-		$object = new MyPackageHandler();
84
-		$object->setSupportedPackageFormats(array("zip", "jar"));
85
-		$this->assertEqual($object->getSupportedPackageFormats(), array("zip", "jar"));
86
-	}
82
+    public function testSupportedPackageFormatsValid() {
83
+        $object = new MyPackageHandler();
84
+        $object->setSupportedPackageFormats(array("zip", "jar"));
85
+        $this->assertEqual($object->getSupportedPackageFormats(), array("zip", "jar"));
86
+    }
87 87
 }
Please login to merge, or discard this patch.
plugin/pens/lib/tests/test_pens_server.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -46,77 +46,77 @@
 block discarded – undo
46 46
  */
47 47
 class TestPENSServer extends WebTestCase {
48 48
 	
49
-	private $_valid_params = array(
50
-		"command" => "collect",
51
-		"pens-version" => "1.0.0",
52
-		"package-type" => "aicc-pkg",
53
-		"package-type-version" => "1.0",
54
-		"package-format" => "zip",
55
-		"package-id" => "http://myurl.com/12345",
56
-		"package-url" => "http://www.aicc.org/pens/sample/captivatequiz.zip",
57
-		"package-url-expiry" => "2099-04-09T14:17:43Z",
58
-		"client" => "test-pens-server",
59
-		"receipt" => PENS_TEST_RECEIPT_MAILTO);
49
+    private $_valid_params = array(
50
+        "command" => "collect",
51
+        "pens-version" => "1.0.0",
52
+        "package-type" => "aicc-pkg",
53
+        "package-type-version" => "1.0",
54
+        "package-format" => "zip",
55
+        "package-id" => "http://myurl.com/12345",
56
+        "package-url" => "http://www.aicc.org/pens/sample/captivatequiz.zip",
57
+        "package-url-expiry" => "2099-04-09T14:17:43Z",
58
+        "client" => "test-pens-server",
59
+        "receipt" => PENS_TEST_RECEIPT_MAILTO);
60 60
 		
61
-	public function testEmptyQuery() {
62
-		$this->get(PENS_TEST_SERVER_URL);
63
-		$this->assertText("error=2002");
64
-	}
61
+    public function testEmptyQuery() {
62
+        $this->get(PENS_TEST_SERVER_URL);
63
+        $this->assertText("error=2002");
64
+    }
65 65
 	
66
-	public function testValidQuery() {
67
-		$this->get(PENS_TEST_SERVER_URL, $this->_valid_params);
68
-		$this->assertText("error=0");
69
-	}
66
+    public function testValidQuery() {
67
+        $this->get(PENS_TEST_SERVER_URL, $this->_valid_params);
68
+        $this->assertText("error=0");
69
+    }
70 70
 	
71
-	private function invalidParameterTest($name, $value, $error) {
72
-		$params = $this->_valid_params;
73
-		$params[$name] = $value;
74
-		$this->get(PENS_TEST_SERVER_URL, $params);
75
-		$this->assertText("error=".$error);
76
-	}
71
+    private function invalidParameterTest($name, $value, $error) {
72
+        $params = $this->_valid_params;
73
+        $params[$name] = $value;
74
+        $this->get(PENS_TEST_SERVER_URL, $params);
75
+        $this->assertText("error=".$error);
76
+    }
77 77
 	
78
-	private function validParameterTest($name, $value) {
79
-		$params = $this->_valid_params;
80
-		$params[$name] = $value;
81
-		$this->get(PENS_TEST_SERVER_URL, $params);
82
-		$this->assertText("error=0");
83
-	}
78
+    private function validParameterTest($name, $value) {
79
+        $params = $this->_valid_params;
80
+        $params[$name] = $value;
81
+        $this->get(PENS_TEST_SERVER_URL, $params);
82
+        $this->assertText("error=0");
83
+    }
84 84
 	
85
-	public function testInvalidCommand() {
86
-		$this->invalidParameterTest("command", "invalid", 2002);
87
-	}
85
+    public function testInvalidCommand() {
86
+        $this->invalidParameterTest("command", "invalid", 2002);
87
+    }
88 88
 	
89
-	public function testInvalidVersion() {
90
-		$this->invalidParameterTest("pens-version", "0.8.0", 2001);
91
-	}
89
+    public function testInvalidVersion() {
90
+        $this->invalidParameterTest("pens-version", "0.8.0", 2001);
91
+    }
92 92
 	
93
-	public function testInvalidPackageType() {
94
-		$this->invalidParameterTest("package-type", "invalid", 2003);
95
-	}
93
+    public function testInvalidPackageType() {
94
+        $this->invalidParameterTest("package-type", "invalid", 2003);
95
+    }
96 96
 	
97
-	public function testEmptyPackageTypeVersion() {
98
-		$this->invalidParameterTest("package-type-version", null, 2004);
99
-	}
97
+    public function testEmptyPackageTypeVersion() {
98
+        $this->invalidParameterTest("package-type-version", null, 2004);
99
+    }
100 100
 	
101
-	public function testInvalidPackageFormat() {
102
-		$this->invalidParameterTest("package-format", "invalid", 2005);
103
-	}
101
+    public function testInvalidPackageFormat() {
102
+        $this->invalidParameterTest("package-format", "invalid", 2005);
103
+    }
104 104
 	
105
-	public function testInvalidPackageId() {
106
-		$this->invalidParameterTest("package-id", "invalid", 2007);
107
-	}
105
+    public function testInvalidPackageId() {
106
+        $this->invalidParameterTest("package-id", "invalid", 2007);
107
+    }
108 108
 	
109
-	public function testInvalidPackageUrl() {
110
-		$this->invalidParameterTest("package-url", "invalid", 2008);
111
-	}
109
+    public function testInvalidPackageUrl() {
110
+        $this->invalidParameterTest("package-url", "invalid", 2008);
111
+    }
112 112
 	
113
-	public function testInvalidPackageUrlExpiry() {
114
-		$this->invalidParameterTest("package-url-expiry", "invalid", 2009);
115
-	}
113
+    public function testInvalidPackageUrlExpiry() {
114
+        $this->invalidParameterTest("package-url-expiry", "invalid", 2009);
115
+    }
116 116
 	
117
-	public function testValidPackageUrlExpiry() {
118
-		$this->validParameterTest("package-url-expiry", "2099-01-01");
119
-	}
117
+    public function testValidPackageUrlExpiry() {
118
+        $this->validParameterTest("package-url-expiry", "2099-01-01");
119
+    }
120 120
 	
121 121
 }
122 122
 
Please login to merge, or discard this patch.