Skip to content

Commit 7a98a0e

Browse files
committed
Merge branch 'develop'
2 parents 759c068 + b772ec4 commit 7a98a0e

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

Uri.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function polyfill()
6161
{
6262
$this->scheme = "http";
6363
$this->host = "localhost";
64-
$this->port = 80;
64+
$this->port = null;
6565
$this->user = "";
6666
$this->pass = "";
6767
$this->path = "";

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "maplephp/http",
3-
"version": "v1.2.1",
3+
"version": "v1.2.2",
44
"type": "library",
55
"description": "MaplePHP/Http is a powerful and easy-to-use PHP library that fully supports the PSR-7 HTTP message interfaces.",
66
"keywords": [

tests/unitary-request.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33
$unit = new MaplePHP\Unitary\Unit();
44

55
// If you build your library right it will become very easy to mock, like I have below.
6-
$request = new MaplePHP\Http\Request(
7-
"POST", // The HTTP Method (GET, POST, PUT, DELETE, PATCH)
8-
"https://admin:[email protected]:65535/test.php?id=5221&place=stockholm", // The Request URI
9-
["Content-Type" => "application/x-www-form-urlencoded"], // Add Headers, empty array is allowed
10-
["email" => "[email protected]"] // Post data
11-
);
126

137
// Begin by adding a test
14-
$unit->case("MaplePHP Request URI path test", function() use($request) {
8+
$unit->case("MaplePHP Request URI path test", function() {
9+
$request = new MaplePHP\Http\Request(
10+
"POST", // The HTTP Method (GET, POST, PUT, DELETE, PATCH)
11+
"https://admin:[email protected]:65535/test.php?id=5221&place=stockholm", // The Request URI
12+
["Content-Type" => "application/x-www-form-urlencoded"], // Add Headers, empty array is allowed
13+
["email" => "[email protected]"] // Post data
14+
);
1515

16-
// Test 1
1716
$this->add($request->getMethod(), function() {
1817
return $this->equal("POST");
1918

2019
}, "HTTP Request method Type is not POST");
21-
// Adding a error message is not required, but it is highly recommended
20+
// Adding an error message is not required, but it is highly recommended
2221

23-
// Test 2
2422
$this->add($request->getUri()->getPort(), [
2523
"isInt" => [], // Has no arguments = empty array
2624
"min" => [1], // Strict way is to pass each argument to array
@@ -29,7 +27,6 @@
2927

3028
], "Is not a valid port number");
3129

32-
// Test 3
3330
$this->add($request->getUri()->getUserInfo(), [
3431
"isString" => [],
3532
"User validation" => function($value) {
@@ -38,6 +35,8 @@
3835
}
3936

4037
], "Is not a valid port number");
41-
});
4238

43-
$unit->execute();
39+
$this->add((string)$request->withUri(new \MaplePHP\Http\Uri("https://example.se"))->getUri(), [
40+
"equal" => ["https://example.se"],
41+
], "GetUri expects https://example.se as result");
42+
});

0 commit comments

Comments
 (0)