Skip to content

Commit 86d5d09

Browse files
committed
Add php example, including a unit test
1 parent b499b12 commit 86d5d09

File tree

8 files changed

+2322
-1
lines changed

8 files changed

+2322
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository demonstrates an advanced use case of setup workflow feature on C
77
## Files
88

99
* `.circleci/config.yml` implements both 1) the setup workflow, and 2) common resources (i.e., jobs and commands) for main workflows/jobs.
10-
* `php/.circleci/config.yml`, `js/.circleci/config.yml`, and `e2e/.circleci/config.yml` implement independent modular configs for modules php/, js/, and e2e/, respectively.
10+
* `php/.circleci/config.yml`, `js/.circleci/config.yml`, and `e2e/.circleci/config.yml` implement independent modular configs for modules `php/`, `js/`, and `e2e/`, respectively.
1111

1212
## How does it work?
1313

php/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
.phpunit.result.cache

php/.phpcs.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Coding Standard for Example PHP">
3+
4+
<rule ref="PSR12" />
5+
6+
<arg value="p"/>
7+
<arg value="s"/>
8+
<arg name="extensions" value="php"/>
9+
10+
<!-- Include only the directories containing PHP files. -->
11+
<file>src/</file>
12+
<file>test/</file>
13+
</ruleset>

php/.phpunit.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
convertDeprecationsToExceptions="true"
6+
colors="true"
7+
verbose="true"
8+
cacheDirectory=".phpunit.cache"
9+
failOnRisky="true"
10+
failOnWarning="true">
11+
<testsuites>
12+
<testsuite name="test">
13+
<directory>test</directory>
14+
</testsuite>
15+
</testsuites>
16+
<php>
17+
<ini name="precision" value="14"/>
18+
<ini name="serialize_precision" value="14"/>
19+
20+
<const name="PHPUNIT_TESTSUITE" value="true"/>
21+
</php>
22+
</phpunit>

php/composer.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "asw/example-php",
3+
"description": "Example PHP directory",
4+
"type": "library",
5+
"license": "GPL-2.0-or-later",
6+
"autoload": {
7+
"psr-4": {
8+
"Asw\\ExamplePhp\\": "src/"
9+
}
10+
},
11+
"authors": [
12+
{
13+
"name": "Ryan Kienstra",
14+
"email": "[email protected]"
15+
}
16+
],
17+
"require-dev": {
18+
"phpunit/phpunit": "^9.5",
19+
"sirbrillig/phpcs-variable-analysis": "^2.11"
20+
},
21+
"scripts": {
22+
"lint": "phpcs",
23+
"lint-fix": "phpcbf",
24+
"test": "phpunit"
25+
}
26+
}

0 commit comments

Comments
 (0)