mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-11-30 04:39:48 +01:00
add static analysis tests (#180)
This commit is contained in:
parent
5a7fde29a5
commit
53f657273b
4
.github/workflows/security-analysis.yml
vendored
4
.github/workflows/security-analysis.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: "security analysis"
|
||||
|
||||
on:
|
||||
on:
|
||||
pull_request: ~
|
||||
push: ~
|
||||
|
||||
@ -23,7 +23,7 @@ jobs:
|
||||
- name: "installing dependencies"
|
||||
run: |
|
||||
make install-root-dependencies
|
||||
make install-type-check-dependencies
|
||||
make install-static-analysis-dependencies
|
||||
|
||||
- name: "running security analysis ( psalm )"
|
||||
run: make security-analysis
|
||||
|
7
.github/workflows/static-analysis.yml
vendored
7
.github/workflows/static-analysis.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: "static analysis"
|
||||
|
||||
on:
|
||||
on:
|
||||
pull_request: ~
|
||||
push: ~
|
||||
schedule:
|
||||
@ -25,7 +25,10 @@ jobs:
|
||||
- name: "installing dependencies"
|
||||
run: |
|
||||
make install-root-dependencies
|
||||
make install-type-check-dependencies
|
||||
make install-static-analysis-dependencies
|
||||
|
||||
- name: "running static analysis"
|
||||
run: make static-analysis
|
||||
|
||||
- name: "calculating type coverage"
|
||||
run: make type-coverage
|
||||
|
@ -77,7 +77,7 @@ for the end user.
|
||||
|
||||
PSL is configured to pass the strictest psalm level.
|
||||
|
||||
To ensure that your code doesn't contain any type issues, use `make type-check`.
|
||||
To ensure that your code doesn't contain any type issues, use `make static-analysis`.
|
||||
|
||||
To ensure that your code doesn't introduce any security issues, use `make security-analysis`
|
||||
|
||||
|
9
Makefile
9
Makefile
@ -5,13 +5,13 @@ install-coding-standard-dependencies:
|
||||
cd tools/php-cs-fixer && composer update --ignore-platform-req php
|
||||
cd tools/php-codesniffer && composer update
|
||||
|
||||
install-type-check-dependencies:
|
||||
install-static-analysis-dependencies:
|
||||
cd tools/psalm && composer update
|
||||
|
||||
install-unit-tests-dependencies:
|
||||
cd tools/phpunit && composer update
|
||||
|
||||
install: install-root-dependencies install-coding-standard-dependencies install-type-check-dependencies install-unit-tests-dependencies
|
||||
install: install-root-dependencies install-coding-standard-dependencies install-static-analysis-dependencies install-unit-tests-dependencies
|
||||
|
||||
coding-standard-fix:
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist
|
||||
@ -21,8 +21,9 @@ coding-standard-check:
|
||||
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist --dry-run
|
||||
php tools/php-codesniffer/vendor/bin/phpcs --basepath=. --standard=tools/php-codesniffer/.phpcs.xml
|
||||
|
||||
type-check:
|
||||
static-analysis:
|
||||
php tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml
|
||||
php tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml tests/static-analysis
|
||||
|
||||
type-coverage:
|
||||
php tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml --shepherd --stats
|
||||
@ -37,4 +38,4 @@ code-coverage: unit-tests
|
||||
composer global require php-coveralls/php-coveralls
|
||||
php-coveralls -x tests/logs/clover.xml -o tests/logs/coveralls-upload.json -v
|
||||
|
||||
check: coding-standard-check type-check security-analysis unit-tests
|
||||
check: coding-standard-check static-analysis security-analysis unit-tests
|
||||
|
@ -27,7 +27,8 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Psl\\Tests\\": "tests/Psl"
|
||||
"Psl\\Tests\\StaticAnalysis\\": "tests/static-analysis",
|
||||
"Psl\\Tests\\Unit\\": "tests/unit"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
@ -39,4 +40,4 @@
|
||||
"url": "https://github.com/hhvm/hsl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
tests/.cache/.gitignore
vendored
2
tests/.cache/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
67
tests/static-analysis/Iter/count.php
Normal file
67
tests/static-analysis/Iter/count.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Iter;
|
||||
|
||||
use Psl\Iter;
|
||||
use Psl\Math;
|
||||
|
||||
/** @param positive-int $_foo */
|
||||
function take_positive_integer(int $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @param 0 $_foo */
|
||||
function take_zero(int $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-list<int> */
|
||||
function return_non_empty_list(): array
|
||||
{
|
||||
return [
|
||||
Math\maxva(1, 2, 3),
|
||||
Math\maxva(3, 4, 4),
|
||||
];
|
||||
}
|
||||
|
||||
/** @return non-empty-array<int, string> */
|
||||
function return_non_empty_array(): array
|
||||
{
|
||||
return [
|
||||
Math\maxva(1, 2, 3) => 'hello',
|
||||
Math\maxva(3, 4, 4) => 'hello',
|
||||
];
|
||||
}
|
||||
|
||||
/** @return array{1: 'h', 2: 'c'} */
|
||||
function return_non_empty_keyed_array(): array
|
||||
{
|
||||
return [1 => 'h', 2 => 'c'];
|
||||
}
|
||||
|
||||
/** @return array<empty, empty> */
|
||||
function return_array(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
function test(): void
|
||||
{
|
||||
take_positive_integer(
|
||||
Iter\count(return_non_empty_array())
|
||||
);
|
||||
|
||||
take_positive_integer(
|
||||
Iter\count(return_non_empty_list())
|
||||
);
|
||||
|
||||
take_positive_integer(
|
||||
Iter\count(return_non_empty_keyed_array())
|
||||
);
|
||||
|
||||
take_zero(
|
||||
Iter\count(return_array())
|
||||
);
|
||||
}
|
57
tests/static-analysis/Iter/first.php
Normal file
57
tests/static-analysis/Iter/first.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Iter;
|
||||
|
||||
use Psl\Iter;
|
||||
|
||||
/** @param int $_foo */
|
||||
function take_integer(int $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-list<int> */
|
||||
function return_non_empty_integer_list(): array
|
||||
{
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
/** @return non-empty-array<int, int> */
|
||||
function return_non_empty_integer_array(): array
|
||||
{
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
/** @return array{1: int, 2: int} */
|
||||
function return_non_empty_keyed_array(): array
|
||||
{
|
||||
return [1 => 5, 2 => 4];
|
||||
}
|
||||
|
||||
function test(): void
|
||||
{
|
||||
take_integer(
|
||||
Iter\first(return_non_empty_integer_list())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\first_key(return_non_empty_integer_list())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\first(return_non_empty_integer_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\first_key(return_non_empty_integer_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\first(return_non_empty_keyed_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\first_key(return_non_empty_keyed_array())
|
||||
);
|
||||
}
|
57
tests/static-analysis/Iter/last.php
Normal file
57
tests/static-analysis/Iter/last.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Iter;
|
||||
|
||||
use Psl\Iter;
|
||||
|
||||
/** @param int $_foo */
|
||||
function take_integer(int $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-list<int> */
|
||||
function return_non_empty_integer_list(): array
|
||||
{
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
/** @return non-empty-array<int, int> */
|
||||
function return_non_empty_integer_array(): array
|
||||
{
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
/** @return array{1: int, 2: int} */
|
||||
function return_non_empty_keyed_array(): array
|
||||
{
|
||||
return [1 => 5, 2 => 4];
|
||||
}
|
||||
|
||||
function test(): void
|
||||
{
|
||||
take_integer(
|
||||
Iter\last(return_non_empty_integer_list())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\last_key(return_non_empty_integer_list())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\last(return_non_empty_integer_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\last_key(return_non_empty_integer_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\last(return_non_empty_keyed_array())
|
||||
);
|
||||
|
||||
take_integer(
|
||||
Iter\last_key(return_non_empty_keyed_array())
|
||||
);
|
||||
}
|
30
tests/static-analysis/Regex/match.php
Normal file
30
tests/static-analysis/Regex/match.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Regex;
|
||||
|
||||
use Psl;
|
||||
use Psl\Regex;
|
||||
|
||||
function take_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Regex\Exception\ExceptionInterface
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
$subject = 'PHP is the web scripting language of choice.';
|
||||
$pattern = '/(php)/i';
|
||||
|
||||
$e = Regex\capture_groups([1]);
|
||||
$first_match = Regex\first_match($subject, $pattern, $e);
|
||||
|
||||
Psl\invariant($first_match !== null, 'It matches!');
|
||||
|
||||
take_string($first_match[0]);
|
||||
take_string($first_match[1]);
|
||||
}
|
61
tests/static-analysis/Str/after.php
Normal file
61
tests/static-analysis/Str/after.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return lowercase-string */
|
||||
function return_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
$str = Str\after(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\after_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\after_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\after(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\after_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\after_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\after(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\after_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\after_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
}
|
60
tests/static-analysis/Str/before.php
Normal file
60
tests/static-analysis/Str/before.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
/** @return lowercase-string */
|
||||
function return_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
$str = Str\before(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\before_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\before_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\before(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\before_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Byte\before_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\before(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\before_last(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
|
||||
$str = Str\Grapheme\before_last_ci(return_lowercase_string(), 'h');
|
||||
Psl\invariant($str !== null, '!');
|
||||
take_lowercase_string($str);
|
||||
}
|
50
tests/static-analysis/Str/chunk.php
Normal file
50
tests/static-analysis/Str/chunk.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @return non-empty-string */
|
||||
function return_nonempty_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @param non-empty-list<non-empty-string> $_list */
|
||||
function take_non_empty_string_list(array $_list): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-lowercase-string */
|
||||
function return_nonempty_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @param non-empty-list<non-empty-lowercase-string> $_list */
|
||||
function take_non_empty_lowercase_string_list(array $_list): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_non_empty_string_list(
|
||||
Str\chunk(return_nonempty_string())
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string_list(
|
||||
Str\chunk(return_nonempty_lowercase_string())
|
||||
);
|
||||
|
||||
take_non_empty_string_list(
|
||||
Str\Byte\chunk(return_nonempty_string())
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string_list(
|
||||
Str\Byte\chunk(return_nonempty_lowercase_string())
|
||||
);
|
||||
}
|
60
tests/static-analysis/Str/lowercase.php
Normal file
60
tests/static-analysis/Str/lowercase.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param non-empty-lowercase-string $_foo */
|
||||
function take_non_empty_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-string */
|
||||
function return_non_empty_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/** @return non-falsy-string */
|
||||
function return_non_falsy_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_lowercase_string(
|
||||
Str\lowercase('hello')
|
||||
);
|
||||
|
||||
take_lowercase_string(
|
||||
Str\Byte\lowercase('hello')
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string(
|
||||
Str\lowercase(return_non_empty_string())
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string(
|
||||
Str\lowercase(return_non_falsy_string())
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string(
|
||||
Str\Byte\lowercase(return_non_empty_string())
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string(
|
||||
Str\Byte\lowercase(return_non_falsy_string())
|
||||
);
|
||||
}
|
54
tests/static-analysis/Str/repeat.php
Normal file
54
tests/static-analysis/Str/repeat.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @return non-empty-string */
|
||||
function return_nonempty_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @return non-empty-lowercase-string */
|
||||
function return_nonempty_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @return lowercase-string */
|
||||
function return_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/** @param non-empty-lowercase-string $_foo */
|
||||
function take_non_empty_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
/** @param non-empty-string $_foo */
|
||||
function take_non_empty_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @param "hhh" $_x */
|
||||
function take_triple_h_string(string $_x): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_non_empty_lowercase_string(Str\repeat(return_nonempty_lowercase_string(), 4));
|
||||
take_non_empty_string(Str\repeat(return_nonempty_string(), 4));
|
||||
take_lowercase_string(Str\repeat(return_lowercase_string(), 4));
|
||||
|
||||
take_triple_h_string(Str\repeat('h', 3));
|
||||
}
|
37
tests/static-analysis/Str/slice.php
Normal file
37
tests/static-analysis/Str/slice.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return lowercase-string */
|
||||
function return_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function tests(): void
|
||||
{
|
||||
take_lowercase_string(
|
||||
Str\slice(return_lowercase_string(), 3, 5)
|
||||
);
|
||||
|
||||
take_lowercase_string(
|
||||
Str\Byte\slice(return_lowercase_string(), 3, 5)
|
||||
);
|
||||
|
||||
take_lowercase_string(
|
||||
Str\Grapheme\slice(return_lowercase_string(), 3, 5)
|
||||
);
|
||||
}
|
32
tests/static-analysis/Str/splice.php
Normal file
32
tests/static-analysis/Str/splice.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param lowercase-string $_foo */
|
||||
function take_lowercase_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
/** @return lowercase-string */
|
||||
function return_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_lowercase_string(
|
||||
Str\splice(return_lowercase_string(), return_lowercase_string(), 0)
|
||||
);
|
||||
|
||||
take_lowercase_string(
|
||||
Str\Byte\splice(return_lowercase_string(), return_lowercase_string(), 0)
|
||||
);
|
||||
}
|
50
tests/static-analysis/Str/split.php
Normal file
50
tests/static-analysis/Str/split.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @return non-empty-string */
|
||||
function return_nonempty_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @param non-empty-list<non-empty-string> $_list */
|
||||
function take_non_empty_string_list(array $_list): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-lowercase-string */
|
||||
function return_nonempty_lowercase_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
/** @param non-empty-list<non-empty-lowercase-string> $_list */
|
||||
function take_non_empty_lowercase_string_list(array $_list): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_non_empty_string_list(
|
||||
Str\split(return_nonempty_string(), 'x')
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string_list(
|
||||
Str\split(return_nonempty_lowercase_string(), 'x')
|
||||
);
|
||||
|
||||
take_non_empty_string_list(
|
||||
Str\Byte\split(return_nonempty_string(), 'x')
|
||||
);
|
||||
|
||||
take_non_empty_lowercase_string_list(
|
||||
Str\Byte\split(return_nonempty_lowercase_string(), 'x')
|
||||
);
|
||||
}
|
47
tests/static-analysis/Str/uppercase.php
Normal file
47
tests/static-analysis/Str/uppercase.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\StaticAnalysis\Str;
|
||||
|
||||
use Psl;
|
||||
use Psl\Str;
|
||||
|
||||
/** @param non-empty-string $_foo */
|
||||
function take_non_empty_string(string $_foo): void
|
||||
{
|
||||
}
|
||||
|
||||
/** @return non-empty-string */
|
||||
function return_non_empty_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/** @return non-falsy-string */
|
||||
function return_non_falsy_string(): string
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Psl\Exception\InvariantViolationException
|
||||
*/
|
||||
function test(): void
|
||||
{
|
||||
take_non_empty_string(
|
||||
Str\uppercase(return_non_empty_string())
|
||||
);
|
||||
|
||||
take_non_empty_string(
|
||||
Str\Byte\uppercase(return_non_empty_string())
|
||||
);
|
||||
|
||||
take_non_empty_string(
|
||||
Str\uppercase(return_non_falsy_string())
|
||||
);
|
||||
|
||||
take_non_empty_string(
|
||||
Str\Byte\uppercase(return_non_falsy_string())
|
||||
);
|
||||
}
|
2
tests/unit/.cache/.gitignore
vendored
Normal file
2
tests/unit/.cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.gitignore
|
||||
!.gitignore
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
||||
@ -15,7 +15,7 @@ final class MapKeysTest extends TestCase
|
||||
public function testMapKeys(array $expected, array $array, callable $function): void
|
||||
{
|
||||
$result = Arr\map_keys($array, $function);
|
||||
|
||||
|
||||
static::assertSame($expected, $result);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
||||
@ -15,7 +15,7 @@ final class MapWithKeyTest extends TestCase
|
||||
public function testMapWithKey(array $expected, array $array, callable $function): void
|
||||
{
|
||||
$result = Arr\map_with_key($array, $function);
|
||||
|
||||
|
||||
static::assertSame($expected, $result);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Arr;
|
||||
namespace Psl\Tests\Unit\Arr;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Arr;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection\MapInterface;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection\VectorInterface;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use Psl\Collection\Map;
|
||||
use Psl\Collection\Vector;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use Psl\Collection\Map;
|
||||
use Psl\Collection\MutableMap;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use Psl\Collection\Map;
|
||||
use Psl\Collection\MutableVector;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Collection;
|
||||
namespace Psl\Tests\Unit\Collection;
|
||||
|
||||
use Psl\Collection\Vector;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\DataStructure;
|
||||
namespace Psl\Tests\Unit\DataStructure;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Collection;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
||||
@ -15,7 +15,7 @@ final class MapKeysTest extends TestCase
|
||||
public function testMapKeys(array $expected, array $array, callable $function): void
|
||||
{
|
||||
$result = Dict\map_keys($array, $function);
|
||||
|
||||
|
||||
static::assertSame($expected, $result);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
||||
@ -15,7 +15,7 @@ final class MapWithKeyTest extends TestCase
|
||||
public function testMapWithKey(array $expected, array $array, callable $function): void
|
||||
{
|
||||
$result = Dict\map_with_key($array, $function);
|
||||
|
||||
|
||||
static::assertSame($expected, $result);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
||||
@ -12,7 +12,7 @@ final class ReindexTest extends TestCase
|
||||
public function testReindex(): void
|
||||
{
|
||||
$result = Dict\reindex([1, 2, 3], static fn (int $value): int => $value);
|
||||
|
||||
|
||||
static::assertSame([1 => 1, 2 => 2, 3 => 3], $result);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Dict;
|
||||
namespace Psl\Tests\Unit\Dict;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Dict;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user