Skip to content

Commit a21d6b1

Browse files
committed
Merge branch 'develop'
* develop: specify next release use os 4
2 parents 968c46c + 4a2645e commit a21d6b1

File tree

8 files changed

+50
-49
lines changed

8 files changed

+50
-49
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macOS-latest]
11-
php-version: ['8.1', '8.2', '8.3']
11+
php-version: ['8.2', '8.3']
1212
dependencies: ['lowest', 'highest']
1313
name: 'PHPUnit'
1414
steps:
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-latest
3434
strategy:
3535
matrix:
36-
php-version: ['8.1', '8.2', '8.3']
36+
php-version: ['8.2', '8.3']
3737
dependencies: ['lowest', 'highest']
3838
name: 'Psalm'
3939
steps:
@@ -54,7 +54,7 @@ jobs:
5454
runs-on: ubuntu-latest
5555
strategy:
5656
matrix:
57-
php-version: ['8.1']
57+
php-version: ['8.2']
5858
name: 'CS'
5959
steps:
6060
- name: Checkout

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 6.2.0 - 2023-11-01
4+
5+
### Changed
6+
7+
- Requires `innmind/operating-system:~4.0`
8+
9+
### Removed
10+
11+
- Support for PHP `8.1`
12+
313
## 6.1.0 - 2023-09-23
414

515
### Added

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
}
2424
},
2525
"require": {
26-
"php": "~8.1",
26+
"php": "~8.2",
2727
"innmind/url": "~4.1",
2828
"innmind/immutable": "~4.13|~5.0",
29-
"innmind/http-transport": "~6.5"
29+
"innmind/http-transport": "~7.0"
3030
},
3131
"require-dev": {
3232
"phpunit/phpunit": "~9.0",

src/Directives.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function asContent(): Content
152152
),
153153
);
154154

155-
return Content\Lines::of($lines);
155+
return Content::ofLines($lines);
156156
}
157157

158158
private function allows(string $url): bool

src/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use Innmind\HttpTransport\Transport;
88
use Innmind\Url\Url;
99
use Innmind\Http\{
10-
Message\Request\Request,
11-
Message\Method,
10+
Request,
11+
Method,
1212
ProtocolVersion,
1313
Headers,
1414
Header,
@@ -37,7 +37,7 @@ private function __construct(
3737
public function __invoke(Url $url): Maybe
3838
{
3939
return ($this->fulfill)(
40-
new Request(
40+
Request::of(
4141
$url,
4242
Method::get,
4343
ProtocolVersion::v20,

src/RobotsTxt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function disallows(string $userAgent, Url $url): bool
6464

6565
public function asContent(): Content
6666
{
67-
return Content\Lines::of(
67+
return Content::ofLines(
6868
$this
6969
->directives
7070
->map(static fn($directive) => $directive->asContent())

src/UserAgent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function matches(string $userAgent): bool
5858

5959
public function asContent(): Content
6060
{
61-
return Content\Lines::of(
61+
return Content::ofLines(
6262
$this
6363
->agents
6464
->map(static fn($agent) => $agent->prepend('User-agent: '))

tests/ParserTest.php

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
};
1616
use Innmind\Filesystem\File\Content;
1717
use Innmind\Url\Url;
18-
use Innmind\Http\Message\{
18+
use Innmind\Http\{
1919
Request,
20-
StatusCode,
2120
Response,
21+
Response\StatusCode,
22+
ProtocolVersion,
2223
};
2324
use Innmind\Immutable\Either;
2425
use PHPUnit\Framework\TestCase;
@@ -32,31 +33,25 @@ public function testExecution()
3233
'InnmindCrawler',
3334
);
3435
$url = Url::of('http://example.com');
35-
$response = $this->createMock(Response::class);
36-
$response
37-
->expects($this->once())
38-
->method('statusCode')
39-
->willReturn(StatusCode::ok);
40-
$response
41-
->expects($this->once())
42-
->method('body')
43-
->willReturn(
44-
Content\Lines::ofContent(<<<TXT
45-
Sitemap : foo.xml
46-
Host : example.com
47-
Crawl-delay: 10
48-
User-agent : Foo
49-
User-agent : Bar
50-
Allow : /foo
51-
Disallow : /bar
36+
$response = Response::of(
37+
StatusCode::ok,
38+
ProtocolVersion::v11,
39+
null,
40+
Content::ofString(<<<TXT
41+
Sitemap : foo.xml
42+
Host : example.com
43+
Crawl-delay: 10
44+
User-agent : Foo
45+
User-agent : Bar
46+
Allow : /foo
47+
Disallow : /bar
5248
53-
User-agent : *
54-
Disallow :
55-
Crawl-delay : 10
56-
Crawl-delay : 20
57-
TXT
58-
),
59-
);
49+
User-agent : *
50+
Disallow :
51+
Crawl-delay : 10
52+
Crawl-delay : 20
53+
TXT),
54+
);
6055
$transport
6156
->expects($this->once())
6257
->method('__invoke')
@@ -71,8 +66,8 @@ public function testExecution()
7166
) &&
7267
$request->body()->toString() === '';
7368
}))
74-
->willReturn(Either::right(new Success(
75-
$this->createMock(Request::class),
69+
->willReturnCallback(static fn($request) => Either::right(new Success(
70+
$request,
7671
$response,
7772
)));
7873
$expected = 'User-agent: Foo'."\n";
@@ -101,19 +96,15 @@ public function testThrowWhenRequestNotFulfilled()
10196
'InnmindCrawler',
10297
);
10398
$url = Url::of('http://example.com');
104-
$response = $this->createMock(Response::class);
105-
$response
106-
->expects($this->once())
107-
->method('statusCode')
108-
->willReturn(StatusCode::notFound);
109-
$response
110-
->expects($this->never())
111-
->method('body');
99+
$response = Response::of(
100+
StatusCode::notFound,
101+
ProtocolVersion::v11,
102+
);
112103
$transport
113104
->expects($this->once())
114105
->method('__invoke')
115-
->willReturn(Either::left(new ClientError(
116-
$this->createMock(Request::class),
106+
->willReturnCallback(static fn($request) => Either::left(new ClientError(
107+
$request,
117108
$response,
118109
)));
119110

0 commit comments

Comments
 (0)