Skip to content

Commit bc5faee

Browse files
committed
feat: setup tests and formatter
1 parent 7c2c7d4 commit bc5faee

File tree

4 files changed

+98
-32
lines changed

4 files changed

+98
-32
lines changed

.php_cs.dist.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->ignoreDotFiles(true)
10+
->ignoreVCS(true);
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules([
14+
'@PSR12' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
17+
'no_unused_imports' => true,
18+
'not_operator_with_successor_space' => false,
19+
'trailing_comma_in_multiline' => true,
20+
'phpdoc_scalar' => true,
21+
'unary_operator_spaces' => true,
22+
'binary_operator_spaces' => true,
23+
'blank_line_before_statement' => [
24+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
25+
],
26+
'phpdoc_single_line_var_spacing' => true,
27+
'phpdoc_var_without_name' => true,
28+
'method_argument_space' => [
29+
'on_multiline' => 'ensure_fully_multiline',
30+
'keep_multiple_spaces_after_comma' => true,
31+
],
32+
'single_trait_insert_per_statement' => true,
33+
])
34+
->setFinder($finder);

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":{"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/session.test.php::values":3,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/delete.test.php::values":4},"times":{"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/session.test.php::values":0,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/session.test.php::multiple":0,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/delete.test.php::values":0,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/read.test.php::values":0,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/write.test.php::values":0,"\/Users\/mychidarko\/Projects\/leafphp\/leaf-modules\/leaf-session\/tests\/write.test.php::multiple":0}}

composer.json

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
11
{
2-
"name": "leafs/session",
3-
"description": "Leaf PHP session + flash modules",
4-
"keywords": [
5-
"session",
6-
"http",
7-
"flash",
8-
"leaf",
9-
"php",
10-
"framework"
11-
],
12-
"homepage": "https://leafphp.netlify.app/#/",
13-
"type": "library",
14-
"license": "MIT",
15-
"authors": [
16-
{
17-
"name": "Michael Darko",
18-
"email": "[email protected]",
19-
"homepage": "https://mychi.netlify.app",
20-
"role": "Developer"
21-
}
22-
],
23-
"autoload": {
24-
"psr-4": {
25-
"Leaf\\": "src"
26-
},
27-
"files": [
28-
"src/functions.php"
29-
]
2+
"name": "leafs/session",
3+
"description": "Leaf PHP session + flash modules",
4+
"keywords": [
5+
"session",
6+
"http",
7+
"flash",
8+
"leaf",
9+
"php",
10+
"framework"
11+
],
12+
"homepage": "https://leafphp.dev/modules/session/",
13+
"type": "library",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Michael Darko",
18+
"email": "[email protected]",
19+
"homepage": "https://mychi.netlify.app",
20+
"role": "Developer"
21+
}
22+
],
23+
"autoload": {
24+
"psr-4": {
25+
"Leaf\\": "src"
3026
},
31-
"minimum-stability": "dev",
32-
"prefer-stable": true,
33-
"require": {
34-
"leafs/anchor": "*"
27+
"files": [
28+
"src/functions.php"
29+
]
30+
},
31+
"minimum-stability": "dev",
32+
"prefer-stable": true,
33+
"require": {
34+
"leafs/anchor": "*"
35+
},
36+
"require-dev": {
37+
"pestphp/pest": "^1.21",
38+
"friendsofphp/php-cs-fixer": "^3.0"
39+
},
40+
"scripts": {
41+
"format": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes",
42+
"test": "vendor/bin/pest"
43+
},
44+
"config": {
45+
"allow-plugins": {
46+
"pestphp/pest-plugin": true
3547
}
48+
}
3649
}

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory suffix=".test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage processUncoveredFiles="true">
13+
<include>
14+
<directory suffix=".php">./app</directory>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</coverage>
18+
</phpunit>

0 commit comments

Comments
 (0)