Completed
Push — 1.10.x ( e39098...d9ba33 )
by Julito
34:46
created
plugin/pens/lib/pens_client_test.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
  * @licence http://www.gnu.org/licenses/gpl.txt
24 24
  */
25 25
 
26
-require_once __DIR__ . '/pens.php';
26
+require_once __DIR__.'/pens.php';
27 27
 
28 28
 class MyPackageHandler extends PENSPackageHandler {
29 29
 	public function processPackage($request, $path_to_package) {
Please login to merge, or discard this patch.
plugin/pens/lib/pens.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/pens/pens_request_factory.php';
4
-require_once __DIR__ . '/pens/pens_response.php';
5
-require_once __DIR__ . '/pens/pens_package_handler.php';
6
-require_once __DIR__ . '/pens/pens_server.php';
7
-require_once __DIR__ . '/pens/pens_client.php';
3
+require_once __DIR__.'/pens/pens_request_factory.php';
4
+require_once __DIR__.'/pens/pens_response.php';
5
+require_once __DIR__.'/pens/pens_package_handler.php';
6
+require_once __DIR__.'/pens/pens_server.php';
7
+require_once __DIR__.'/pens/pens_client.php';
Please login to merge, or discard this patch.
plugin/pens/lib/pens_server_test.php 2 patches
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 MyPackageHandler extends PENSPackageHandler {
29
-	public function processPackage($request, $path_to_package) {
30
-		// Do the package processing here
31
-	}
29
+    public function processPackage($request, $path_to_package) {
30
+        // Do the package processing here
31
+    }
32 32
 }
33 33
 
34 34
 $handler = new MyPackageHandler();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
  * @licence http://www.gnu.org/licenses/gpl.txt
24 24
  */
25 25
 
26
-require_once __DIR__ . '/pens.php';
26
+require_once __DIR__.'/pens.php';
27 27
 
28 28
 class MyPackageHandler extends PENSPackageHandler {
29 29
 	public function processPackage($request, $path_to_package) {
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.
plugin/pens/lib/tests/test_pens_request.php 2 patches
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -44,170 +44,170 @@
 block discarded – undo
44 44
  */
45 45
 class TestPENSRequest extends UnitTestCase {
46 46
 	
47
-	/**
48
-	 * Valid arguments to be used for tests
49
-	 * 
50
-	 * @var array
51
-	 */
52
-	private $args = null;
53
-	
54
-	public function setUp() {
55
-		$this->args = array(
56
-			"pens-version" => "1.0.0",
57
-			"command" => "collect",
58
-			"package-type" => "aicc-pkg",
59
-			"package-type-version" => "1.0",
60
-			"package-format" => "zip",
61
-			"package-id" => "http://myurl.com/12345",
62
-			"package-url" => "http://myurl.com/mypackage.zip",
63
-			"package-url-expiry" => "2006-04-01T06:51:29Z",
64
-			"client" => "Authorware7",
65
-			"receipt" => "mailto:[email protected]",
66
-			"package-url-user-id" => "guillaumev",
67
-			"package-url-account" => "toto",
68
-			"package-url-password" => "12345",
69
-			"system-user-id" => "guillaumev",
70
-			"system-password" => "12345",
71
-			"alerts" => "http://myurl.com/alerts",
72
-			"vendor-data" => "here are my data");
73
-	}
74
-	
75
-	public function createObject($myargs) {
76
-		return PENSRequestFactory::createPENSRequest($myargs);
77
-	}
78
-	
79
-	public function exceptionTestForValue($key, $value, $code) {
80
-		try {
81
-			$myargs = $this->args;
82
-			if($value === null) {
83
-				unset($myargs[$key]);
84
-			} else {
85
-				$myargs[$key] = $value;
86
-			}
87
-			$object = $this->createObject($myargs);
88
-			$this->fail();
89
-		} catch(PENSException $e) {
90
-			$this->assertEqual($e->getCode(), $code);
91
-		}
92
-	}
93
-	
94
-	public function testPensVersionInvalid() {
95
-		$this->exceptionTestForValue("pens-version", "0.8.0", 2001);
96
-	}
97
-	
98
-	public function testPensVersionNull() {
99
-		$this->exceptionTestForValue("pens-version", null, 2001);
100
-	}
101
-	
102
-	
103
-	public function testCommandInvalid() {
104
-		$this->exceptionTestForValue("command", "testing", 2002);
105
-	}
106
-	
107
-	public function testCommandNull() {
108
-		$this->exceptionTestForValue("command", null, 2002);
109
-	}
110
-	
111
-	public function testPackageTypeInvalid() {
112
-		$this->exceptionTestForValue("package-type", "testing", 2003);
113
-	}
114
-	
115
-	public function testPackageTypeNull() {
116
-		$this->exceptionTestForValue("package-type", null, 2003);
117
-	}
118
-	
119
-	public function testPackageTypeVersionNull() {
120
-		$this->exceptionTestForValue("package-type-version", null, 2004);
121
-	}
122
-	
123
-	public function testPackageFormatInvalid() {
124
-		$this->exceptionTestForValue("package-format", "testing", 2005);
125
-	}
126
-	
127
-	public function testPackageFormatNull() {
128
-		$this->exceptionTestForValue("package-format", null, 2005);
129
-	}
130
-	
131
-	public function testPackageIdInvalid() {
132
-		$this->exceptionTestForValue("package-id", "testing", 2007);
133
-	}
134
-	
135
-	public function testPackageIdNull() {
136
-		$this->exceptionTestForValue("package-id", null, 2007);
137
-	}
138
-	
139
-	public function testPackageUrlInvalid() {
140
-		$this->exceptionTestForValue("package-url", "testing", 2008);
141
-	}
142
-	
143
-	public function testPackageUrlInvalid2() {
144
-		$this->exceptionTestForValue("package-url", "http://myurl.com/mypackage", 2008);
145
-	}
146
-	
147
-	public function testPackageUrlNull() {
148
-		$this->exceptionTestForValue("package-url", null, 2008);
149
-	}
150
-	
151
-	public function testPackageUrlExpiryNull() {
152
-		$this->exceptionTestForValue("package-url-expiry", null, 2009);
153
-	}
154
-	
155
-	public function testPackageUrlExpiryInvalid() {
156
-		$this->exceptionTestForValue("package-url-expiry", "testing", 2009);
157
-	}
158
-	
159
-	public function testClientNull() {
160
-		$this->exceptionTestForValue("client", null, 2010);
161
-	}
162
-	
163
-	public function testReceiptNull() {
164
-		$this->exceptionTestForValue("receipt", null, 2011);
165
-	}
166
-	
167
-	public function testReceiptInvalid() {
168
-		$this->exceptionTestForValue("receipt", "testing", 2011);
169
-	}
170
-	
171
-	public function testAlertsInvalid() {
172
-		$this->exceptionTestForValue("alerts", "testing", 1201);
173
-	}
174
-	
175
-	public function testReceiptValid() {
176
-		try {
177
-			$myargs = $this->args;
178
-			$myargs["receipt"] = "mailto:[email protected],[email protected]";
179
-			$object = $this->createObject($myargs);
180
-			$this->pass();
181
-		} catch(PENSException $e) {
182
-			$this->fail();
183
-		}
184
-	}
185
-	
186
-	public function testValid() {
187
-		try {
188
-			$object = $this->createObject($this->args);
189
-			$this->assertIsA($object, "PENSRequestCollect");
190
-			$this->assertEqual($object->getPensVersion(), "1.0.0");
191
-			$this->assertEqual($object->getPackageType(), "aicc-pkg");
192
-			$this->assertEqual($object->getPackageTypeVersion(), "1.0");
193
-			$this->assertEqual($object->getPackageFormat(), "zip");
194
-			$this->assertEqual($object->getPackageId(), "http://myurl.com/12345");
195
-			$this->assertEqual($object->getPackageUrl(), "http://myurl.com/mypackage.zip");
196
-			$this->assertIsA($object->getPackageUrlExpiry(), "DateTime");
197
-			$this->assertEqual($object->getClient(), "Authorware7");
198
-			$this->assertEqual($object->getReceipt(), "mailto:[email protected]");
199
-			$this->assertEqual($object->getPackageUrlUserId(), "guillaumev");
200
-			$this->assertEqual($object->getPackageUrlAccount(), "toto");
201
-			$this->assertEqual($object->getPackageUrlPassword(), "12345");
202
-			$this->assertEqual($object->getSystemUserId(), "guillaumev");
203
-			$this->assertEqual($object->getSystemPassword(), "12345");
204
-			$this->assertEqual($object->getAlerts(), "http://myurl.com/alerts");
205
-			$this->assertEqual($object->getVendorData(), "here are my data");
47
+    /**
48
+     * Valid arguments to be used for tests
49
+     * 
50
+     * @var array
51
+     */
52
+    private $args = null;
53
+	
54
+    public function setUp() {
55
+        $this->args = array(
56
+            "pens-version" => "1.0.0",
57
+            "command" => "collect",
58
+            "package-type" => "aicc-pkg",
59
+            "package-type-version" => "1.0",
60
+            "package-format" => "zip",
61
+            "package-id" => "http://myurl.com/12345",
62
+            "package-url" => "http://myurl.com/mypackage.zip",
63
+            "package-url-expiry" => "2006-04-01T06:51:29Z",
64
+            "client" => "Authorware7",
65
+            "receipt" => "mailto:[email protected]",
66
+            "package-url-user-id" => "guillaumev",
67
+            "package-url-account" => "toto",
68
+            "package-url-password" => "12345",
69
+            "system-user-id" => "guillaumev",
70
+            "system-password" => "12345",
71
+            "alerts" => "http://myurl.com/alerts",
72
+            "vendor-data" => "here are my data");
73
+    }
74
+	
75
+    public function createObject($myargs) {
76
+        return PENSRequestFactory::createPENSRequest($myargs);
77
+    }
78
+	
79
+    public function exceptionTestForValue($key, $value, $code) {
80
+        try {
81
+            $myargs = $this->args;
82
+            if($value === null) {
83
+                unset($myargs[$key]);
84
+            } else {
85
+                $myargs[$key] = $value;
86
+            }
87
+            $object = $this->createObject($myargs);
88
+            $this->fail();
89
+        } catch(PENSException $e) {
90
+            $this->assertEqual($e->getCode(), $code);
91
+        }
92
+    }
93
+	
94
+    public function testPensVersionInvalid() {
95
+        $this->exceptionTestForValue("pens-version", "0.8.0", 2001);
96
+    }
97
+	
98
+    public function testPensVersionNull() {
99
+        $this->exceptionTestForValue("pens-version", null, 2001);
100
+    }
101
+	
102
+	
103
+    public function testCommandInvalid() {
104
+        $this->exceptionTestForValue("command", "testing", 2002);
105
+    }
106
+	
107
+    public function testCommandNull() {
108
+        $this->exceptionTestForValue("command", null, 2002);
109
+    }
110
+	
111
+    public function testPackageTypeInvalid() {
112
+        $this->exceptionTestForValue("package-type", "testing", 2003);
113
+    }
114
+	
115
+    public function testPackageTypeNull() {
116
+        $this->exceptionTestForValue("package-type", null, 2003);
117
+    }
118
+	
119
+    public function testPackageTypeVersionNull() {
120
+        $this->exceptionTestForValue("package-type-version", null, 2004);
121
+    }
122
+	
123
+    public function testPackageFormatInvalid() {
124
+        $this->exceptionTestForValue("package-format", "testing", 2005);
125
+    }
126
+	
127
+    public function testPackageFormatNull() {
128
+        $this->exceptionTestForValue("package-format", null, 2005);
129
+    }
130
+	
131
+    public function testPackageIdInvalid() {
132
+        $this->exceptionTestForValue("package-id", "testing", 2007);
133
+    }
134
+	
135
+    public function testPackageIdNull() {
136
+        $this->exceptionTestForValue("package-id", null, 2007);
137
+    }
138
+	
139
+    public function testPackageUrlInvalid() {
140
+        $this->exceptionTestForValue("package-url", "testing", 2008);
141
+    }
142
+	
143
+    public function testPackageUrlInvalid2() {
144
+        $this->exceptionTestForValue("package-url", "http://myurl.com/mypackage", 2008);
145
+    }
146
+	
147
+    public function testPackageUrlNull() {
148
+        $this->exceptionTestForValue("package-url", null, 2008);
149
+    }
150
+	
151
+    public function testPackageUrlExpiryNull() {
152
+        $this->exceptionTestForValue("package-url-expiry", null, 2009);
153
+    }
154
+	
155
+    public function testPackageUrlExpiryInvalid() {
156
+        $this->exceptionTestForValue("package-url-expiry", "testing", 2009);
157
+    }
158
+	
159
+    public function testClientNull() {
160
+        $this->exceptionTestForValue("client", null, 2010);
161
+    }
162
+	
163
+    public function testReceiptNull() {
164
+        $this->exceptionTestForValue("receipt", null, 2011);
165
+    }
166
+	
167
+    public function testReceiptInvalid() {
168
+        $this->exceptionTestForValue("receipt", "testing", 2011);
169
+    }
170
+	
171
+    public function testAlertsInvalid() {
172
+        $this->exceptionTestForValue("alerts", "testing", 1201);
173
+    }
174
+	
175
+    public function testReceiptValid() {
176
+        try {
177
+            $myargs = $this->args;
178
+            $myargs["receipt"] = "mailto:[email protected],[email protected]";
179
+            $object = $this->createObject($myargs);
180
+            $this->pass();
181
+        } catch(PENSException $e) {
182
+            $this->fail();
183
+        }
184
+    }
185
+	
186
+    public function testValid() {
187
+        try {
188
+            $object = $this->createObject($this->args);
189
+            $this->assertIsA($object, "PENSRequestCollect");
190
+            $this->assertEqual($object->getPensVersion(), "1.0.0");
191
+            $this->assertEqual($object->getPackageType(), "aicc-pkg");
192
+            $this->assertEqual($object->getPackageTypeVersion(), "1.0");
193
+            $this->assertEqual($object->getPackageFormat(), "zip");
194
+            $this->assertEqual($object->getPackageId(), "http://myurl.com/12345");
195
+            $this->assertEqual($object->getPackageUrl(), "http://myurl.com/mypackage.zip");
196
+            $this->assertIsA($object->getPackageUrlExpiry(), "DateTime");
197
+            $this->assertEqual($object->getClient(), "Authorware7");
198
+            $this->assertEqual($object->getReceipt(), "mailto:[email protected]");
199
+            $this->assertEqual($object->getPackageUrlUserId(), "guillaumev");
200
+            $this->assertEqual($object->getPackageUrlAccount(), "toto");
201
+            $this->assertEqual($object->getPackageUrlPassword(), "12345");
202
+            $this->assertEqual($object->getSystemUserId(), "guillaumev");
203
+            $this->assertEqual($object->getSystemPassword(), "12345");
204
+            $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts");
205
+            $this->assertEqual($object->getVendorData(), "here are my data");
206 206
 			
207
-		} catch(PENSException $e) {
208
-			$this->fail();
209
-		}
210
-	}
207
+        } catch(PENSException $e) {
208
+            $this->fail();
209
+        }
210
+    }
211 211
 	
212 212
 	
213 213
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 	public function exceptionTestForValue($key, $value, $code) {
80 80
 		try {
81 81
 			$myargs = $this->args;
82
-			if($value === null) {
82
+			if ($value === null) {
83 83
 				unset($myargs[$key]);
84 84
 			} else {
85 85
 				$myargs[$key] = $value;
86 86
 			}
87 87
 			$object = $this->createObject($myargs);
88 88
 			$this->fail();
89
-		} catch(PENSException $e) {
89
+		} catch (PENSException $e) {
90 90
 			$this->assertEqual($e->getCode(), $code);
91 91
 		}
92 92
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			$myargs["receipt"] = "mailto:[email protected],[email protected]";
179 179
 			$object = $this->createObject($myargs);
180 180
 			$this->pass();
181
-		} catch(PENSException $e) {
181
+		} catch (PENSException $e) {
182 182
 			$this->fail();
183 183
 		}
184 184
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			$this->assertEqual($object->getAlerts(), "http://myurl.com/alerts");
205 205
 			$this->assertEqual($object->getVendorData(), "here are my data");
206 206
 			
207
-		} catch(PENSException $e) {
207
+		} catch (PENSException $e) {
208 208
 			$this->fail();
209 209
 		}
210 210
 	}
Please login to merge, or discard this patch.
plugin/tour/src/tour_plugin.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,9 +129,9 @@
 block discarded – undo
129 129
      */
130 130
     public function getTourConfig()
131 131
     {
132
-        $pluginPath = api_get_path(PLUGIN_PATH) . 'tour/';
132
+        $pluginPath = api_get_path(PLUGIN_PATH).'tour/';
133 133
 
134
-        $jsonContent = file_get_contents($pluginPath . 'config/tour.json');
134
+        $jsonContent = file_get_contents($pluginPath.'config/tour.json');
135 135
 
136 136
         $jsonData = json_decode($jsonContent, true);
137 137
 
Please login to merge, or discard this patch.
plugin/tour/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
  * @author Angel Fernando Quiroz Campos <[email protected]>
6 6
  * @package chamilo.plugin.tour
7 7
  */
8
-require_once __DIR__ . '/config.php';
8
+require_once __DIR__.'/config.php';
9 9
 
10
-$pluginPath = api_get_path(PLUGIN_PATH) . 'tour/';
11
-$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/';
10
+$pluginPath = api_get_path(PLUGIN_PATH).'tour/';
11
+$pluginWebPath = api_get_path(WEB_PLUGIN_PATH).'tour/';
12 12
 
13 13
 $userId = api_get_user_id();
14 14
 
Please login to merge, or discard this patch.