Skip to content

Commit fea62b7

Browse files
committed
tests: improved descriptions
1 parent 45390b4 commit fea62b7

24 files changed

+83
-83
lines changed

tests/Http.DI/HttpExtension.cookie.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use Tester\Assert;
1010
require __DIR__ . '/../bootstrap.php';
1111

1212

13-
test('cookiePath & cookieDomain', function () {
13+
test('cookie path and domain configuration', function () {
1414
$compiler = new DI\Compiler;
1515
$compiler->addExtension('http', new HttpExtension);
1616
$compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli'));
@@ -30,7 +30,7 @@ test('cookiePath & cookieDomain', function () {
3030
});
3131

3232

33-
test('cookieDomain = domain', function () {
33+
test('cookie domain normalization based on request host', function () {
3434
$compiler = new DI\Compiler;
3535
$compiler->addExtension('http', new HttpExtension);
3636
$compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli'));

tests/Http.DI/HttpExtension.cookieSecure.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use Tester\Assert;
1010
require __DIR__ . '/../bootstrap.php';
1111

1212

13-
test('', function () {
13+
test('cookie secure flag disabled', function () {
1414
$compiler = new DI\Compiler;
1515
$compiler->addExtension('http', new HttpExtension);
1616
$compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli'));
@@ -30,7 +30,7 @@ test('', function () {
3030
});
3131

3232

33-
test('', function () {
33+
test('cookie secure flag enabled', function () {
3434
$compiler = new DI\Compiler;
3535
$compiler->addExtension('http', new HttpExtension);
3636
$compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli'));
@@ -50,7 +50,7 @@ test('', function () {
5050
});
5151

5252

53-
test('', function () {
53+
test('auto cookie secure flag based on HTTPS', function () {
5454
$compiler = new DI\Compiler;
5555
$compiler->addExtension('http', new HttpExtension);
5656
$compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli'));

tests/Http/FileUpload.basic.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use Tester\Assert;
1212
require __DIR__ . '/../bootstrap.php';
1313

1414

15-
test('', function () {
15+
test('basic upload properties', function () {
1616
$upload = new FileUpload([
1717
'name' => 'readme.txt',
1818
'full_path' => 'path/to/readme.txt',
@@ -38,7 +38,7 @@ test('', function () {
3838
});
3939

4040

41-
test('', function () {
41+
test('sanitizing name with image detection', function () {
4242
$upload = new FileUpload([
4343
'name' => '../.image.png',
4444
'type' => 'text/plain',
@@ -57,7 +57,7 @@ test('', function () {
5757
});
5858

5959

60-
test('', function () {
60+
test('no file uploaded', function () {
6161
$upload = new FileUpload([
6262
'name' => '',
6363
'type' => '',
@@ -75,7 +75,7 @@ test('', function () {
7575
});
7676

7777

78-
test('', function () {
78+
test('empty upload data', function () {
7979
$upload = new FileUpload([]);
8080

8181
Assert::false($upload->isOk());
@@ -87,7 +87,7 @@ test('', function () {
8787
});
8888

8989

90-
test('', function () {
90+
test('upload from file path', function () {
9191
$upload = new FileUpload($file = __DIR__ . '/files/file.txt');
9292

9393
Assert::same('file.txt', $upload->getName());

tests/Http/FileUpload.getSanitizedName.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function getSanitizedName(string $name, ?string $type = null): string
2323
}
2424

2525

26-
test('name', function () {
26+
test('sanitized name without MIME', function () {
2727
Assert::same('unknown', getSanitizedName(''));
2828
Assert::same('unknown', getSanitizedName('--'));
2929
Assert::same('foo', getSanitizedName('foo'));
@@ -36,7 +36,7 @@ test('name', function () {
3636
});
3737

3838

39-
test('name & extension', function () {
39+
test('sanitized name with PDF type', function () {
4040
Assert::same('unknown', getSanitizedName('', 'application/pdf'));
4141
Assert::same('unknown', getSanitizedName('--', 'application/pdf'));
4242
Assert::same('foo', getSanitizedName('foo', 'application/pdf'));
@@ -46,7 +46,7 @@ test('name & extension', function () {
4646
});
4747

4848

49-
test('image name & extension', function () {
49+
test('sanitized name with JPEG type', function () {
5050
Assert::same('unknown.jpeg', getSanitizedName('', 'image/jpeg'));
5151
Assert::same('unknown.jpeg', getSanitizedName('--', 'image/jpeg'));
5252
Assert::same('foo.jpeg', getSanitizedName('foo', 'image/jpeg'));

tests/Http/Helpers.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use Tester\Assert;
1212
require __DIR__ . '/../bootstrap.php';
1313

1414

15-
test('', function () {
15+
test('IPv4 address matching', function () {
1616
Assert::true(Helpers::ipMatch('192.168.68.233', '192.168.68.233'));
1717
Assert::false(Helpers::ipMatch('192.168.68.234', '192.168.68.233'));
1818
Assert::true(Helpers::ipMatch('192.168.64.0', '192.168.68.233/20'));
@@ -27,7 +27,7 @@ test('', function () {
2727

2828

2929

30-
test('', function () {
30+
test('IPv6 address matching', function () {
3131
Assert::true(Helpers::ipMatch('2001:db8:0:0:0:0:0:0', '2001:db8::'));
3232
Assert::false(Helpers::ipMatch('2001:db8:0:0:0:0:0:0', '2002:db8::'));
3333
Assert::false(Helpers::ipMatch('2001:db8:0:0:0:0:0:1', '2001:db8::'));
@@ -40,7 +40,7 @@ test('', function () {
4040

4141

4242

43-
test('', function () {
43+
test('date formatting', function () {
4444
Assert::same('Tue, 15 Nov 1994 08:12:31 GMT', Helpers::formatDate('1994-11-15T08:12:31+0000'));
4545
Assert::same('Tue, 15 Nov 1994 08:12:31 GMT', Helpers::formatDate('1994-11-15T10:12:31+0200'));
4646
Assert::same('Tue, 15 Nov 1994 08:12:31 GMT', Helpers::formatDate(new DateTime('1994-11-15T06:12:31-0200')));

tests/Http/Request.detectLanguage.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use Tester\Assert;
1212
require __DIR__ . '/../bootstrap.php';
1313

1414

15-
test('', function () {
15+
test('basic language preference', function () {
1616
$headers = ['Accept-Language' => 'en, cs'];
1717
$request = new Http\Request(new Http\UrlScript, headers: $headers);
1818

@@ -22,7 +22,7 @@ test('', function () {
2222
});
2323

2424

25-
test('', function () {
25+
test('language with quality weights', function () {
2626
$headers = ['Accept-Language' => 'da, en-gb;q=0.8, en;q=0.7'];
2727
$request = new Http\Request(new Http\UrlScript, headers: $headers);
2828

@@ -31,15 +31,15 @@ test('', function () {
3131
});
3232

3333

34-
test('', function () {
34+
test('no Accept-Language header', function () {
3535
$headers = [];
3636
$request = new Http\Request(new Http\UrlScript, headers: $headers);
3737

3838
Assert::null($request->detectLanguage(['en']));
3939
});
4040

4141

42-
test('', function () {
42+
test('invalid Accept-Language header', function () {
4343
$headers = ['Accept-Language' => 'garbage'];
4444
$request = new Http\Request(new Http\UrlScript, headers: $headers);
4545

tests/Http/Request.getOrigin.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ use Tester\Assert;
99
require __DIR__ . '/../bootstrap.php';
1010

1111

12-
test('missing origin', function () {
12+
test('no Origin header', function () {
1313
$request = new Http\Request(new Http\UrlScript);
1414
Assert::null($request->getOrigin());
1515
});
1616

1717

18-
test('opaque origin', function () {
18+
test('origin header \'null\'', function () {
1919
$request = new Http\Request(new Http\UrlScript, headers: [
2020
'Origin' => 'null',
2121
]);
2222
Assert::null($request->getOrigin());
2323
});
2424

2525

26-
test('normal origin', function () {
26+
test('valid Origin header', function () {
2727
$request = new Http\Request(new Http\UrlScript, headers: [
2828
'Origin' => 'https://nette.org',
2929
]);

tests/Http/Request.getRawBody.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use Tester\Assert;
1212
require __DIR__ . '/../bootstrap.php';
1313

1414

15-
test('', function () {
15+
test('raw body retrieval with callback', function () {
1616
$request = new Http\Request(new Http\UrlScript, rawBodyCallback: fn() => 'raw body');
1717

1818
Assert::same('raw body', $request->getRawBody());
1919
});
2020

2121

22-
test('', function () {
22+
test('raw body absence without callback', function () {
2323
$request = new Http\Request(new Http\UrlScript);
2424

2525
Assert::null($request->getRawBody());

tests/Http/Request.headers.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ use Tester\Assert;
1212
require __DIR__ . '/../bootstrap.php';
1313

1414

15-
test('', function () {
15+
test('empty headers by default', function () {
1616
$request = new Http\Request(new Http\UrlScript);
1717
Assert::same([], $request->getHeaders());
1818
});
1919

20-
test('', function () {
20+
test('headers initialization without parameters', function () {
2121
$request = new Http\Request(new Http\UrlScript);
2222
Assert::same([], $request->getHeaders());
2323
});
2424

25-
test('', function () {
25+
test('header normalization and case insensitivity', function () {
2626
$request = new Http\Request(new Http\UrlScript, headers: [
2727
'one' => '1',
2828
'TWO' => '2',

tests/Http/Request.invalidEncoding.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $_FILES = [
6464
],
6565
];
6666

67-
test('unfiltered data', function () {
67+
test('binary data preservation with invalid encoding', function () {
6868
$factory = new Http\RequestFactory;
6969
$factory->setBinary();
7070
$request = $factory->fromGlobals();
@@ -93,7 +93,7 @@ test('unfiltered data', function () {
9393
});
9494

9595

96-
test('filtered data', function () {
96+
test('invalid encoding sanitization by default', function () {
9797
$factory = new Http\RequestFactory;
9898
$request = $factory->fromGlobals();
9999

0 commit comments

Comments
 (0)