Skip to content

Commit 9682371

Browse files
committed
Kick off
1 parent 6704390 commit 9682371

22 files changed

Lines changed: 546 additions & 0 deletions

.docs/README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Contributte Phpunit
2+
3+
## Installation
4+
5+
```bash
6+
composer require --dev contributte/phpunit
7+
```
8+
9+
## Usage
10+
11+
## Extensions
12+
13+
### CleanerExtension
14+
15+
This extesions clean your defined folders.
16+
17+
```xml
18+
<?xml version="1.0" encoding="UTF-8"?>
19+
<phpunit>
20+
<!-- your configuration -->
21+
<extensions>
22+
<bootstrap class="Contributte\Phpunit\Extension\CleanerExtension">
23+
<parameter name="dirs" value="tests/tmp"/>
24+
</bootstrap>
25+
</extensions>
26+
</phpunit>
27+
```
28+
29+
### BypassFinalExtension
30+
31+
This extension uses `nette/tester` and its `Environment::bypassFinals()`. It allows you mock final classes and methods. [Read more in docs.](https://tester.nette.org/en/helpers#toc-environment-bypassfinals)
32+
33+
```xml
34+
<?xml version="1.0" encoding="UTF-8"?>
35+
<phpunit>
36+
<!-- your configuration -->
37+
<extensions>
38+
<bootstrap class="Contributte\Phpunit\Extension\BypassFinalExtension"/>
39+
</extensions>
40+
</phpunit>
41+
```
42+
43+
## Example
44+
45+
Full example of `phpunit.xml`.
46+
47+
```xml
48+
<?xml version="1.0" encoding="UTF-8"?>
49+
<phpunit
50+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
51+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
52+
backupGlobals="false"
53+
beStrictAboutTestsThatDoNotTestAnything="true"
54+
beStrictAboutOutputDuringTests="true"
55+
colors="true"
56+
failOnRisky="true"
57+
failOnWarning="true"
58+
processIsolation="false"
59+
stopOnError="false"
60+
stopOnFailure="false"
61+
cacheResult="true"
62+
cacheResultFile="var/tmp/.phpunit.result.cache"
63+
bootstrap="tests/bootstrap.php"
64+
>
65+
<php>
66+
<ini name="memory_limit" value="1048M"/>
67+
<ini name="date.timezone" value="Europe/Prague"/>
68+
</php>
69+
<testsuites>
70+
<testsuite name="App.Build">
71+
<directory>./tests/Cases/Build</directory>
72+
</testsuite>
73+
<testsuite name="App.E2E">
74+
<directory>./tests/Cases/E2E</directory>
75+
</testsuite>
76+
<testsuite name="App.Unit">
77+
<directory>./tests/Cases/Unit</directory>
78+
</testsuite>
79+
</testsuites>
80+
<extensions>
81+
<bootstrap class="Contributte\Phpunit\Extension\CleanerExtension">
82+
<parameter name="dirs" value=""/>
83+
</bootstrap>
84+
<bootstrap class="Contributte\Phpunit\Extension\BypassFinalExtension"/>
85+
</extensions>
86+
</phpunit>
87+
```
88+
---------------
89+
90+
Thanks for testing, reporting and contributing.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
indent_style = tab
11+
indent_size = tab
12+
tab_width = 4
13+
14+
[{*.json,*.yml,*.yaml,*.md}]
15+
indent_style = space
16+
indent_size = 2

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Not archived
2+
tests export-ignore
3+
.editorconfig export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
.travis.yml export-ignore
7+
phpstan.neon export-ignore
8+
README.md export-ignore
9+
ruleset.xml export-ignore

.github/workflows/codesniffer.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Codesniffer"
2+
3+
on:
4+
pull_request:
5+
6+
push:
7+
branches: ["*"]
8+
9+
schedule:
10+
- cron: "0 8 * * 1"
11+
12+
jobs:
13+
codesniffer:
14+
name: "Codesniffer"
15+
uses: contributte/.github/.github/workflows/codesniffer.yml@v1

.github/workflows/coverage.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Coverage"
2+
3+
on:
4+
pull_request:
5+
6+
push:
7+
branches: ["*"]
8+
9+
schedule:
10+
- cron: "0 8 * * 1"
11+
12+
jobs:
13+
test80:
14+
name: "Nette Tester"
15+
uses: contributte/.github/.github/workflows/nette-tester-coverage.yml@v1
16+
with:
17+
php: "8.1"

.github/workflows/phpstan.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Phpstan"
2+
3+
on:
4+
pull_request:
5+
6+
push:
7+
branches: ["*"]
8+
9+
schedule:
10+
- cron: "0 8 * * 1"
11+
12+
jobs:
13+
phpstan:
14+
name: "Phpstan"
15+
uses: contributte/.github/.github/workflows/phpstan.yml@v1

.github/workflows/tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Nette Tester"
2+
3+
on:
4+
pull_request:
5+
6+
push:
7+
branches: ["*"]
8+
9+
schedule:
10+
- cron: "0 8 * * 1"
11+
12+
jobs:
13+
test82:
14+
name: "Nette Tester"
15+
uses: contributte/.github/.github/workflows/nette-tester.yml@v1
16+
with:
17+
php: "8.2"
18+
19+
test81:
20+
name: "Nette Tester"
21+
uses: contributte/.github/.github/workflows/nette-tester.yml@v1
22+
with:
23+
php: "8.1"
24+
composer: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest"

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# IDE
2+
/.idea
3+
4+
# Composer
5+
/vendor
6+
/composer.lock
7+
8+
# Tests
9+
/coverage.xml

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.PHONY: install qa cs csf phpstan tests coverage
2+
3+
install:
4+
composer update
5+
6+
qa: phpstan cs
7+
8+
cs:
9+
ifdef GITHUB_ACTION
10+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp -q --report=checkstyle src tests | cs2pr
11+
else
12+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests
13+
endif
14+
15+
csf:
16+
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests
17+
18+
phpstan:
19+
vendor/bin/phpstan analyse -c phpstan.neon
20+
21+
tests:
22+
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
23+
24+
coverage:
25+
ifdef GITHUB_ACTION
26+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases
27+
else
28+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/Cases
29+
endif

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
![](https://heatbadger.now.sh/github/readme/contributte/phpunit/)
2+
3+
<p align=center>
4+
<a href="https://github.com/contributte/phpunit/actions"><img src="https://badgen.net/github/checks/contributte/phpunit/master?cache=300"></a>
5+
<a href="https://coveralls.io/r/contributte/phpunit"><img src="https://badgen.net/coveralls/c/github/contributte/phpunit?cache=300"></a>
6+
<a href="https://packagist.org/packages/contributte/phpunit"><img src="https://badgen.net/packagist/dm/contributte/phpunit"></a>
7+
<a href="https://packagist.org/packages/contributte/phpunit"><img src="https://badgen.net/packagist/v/contributte/phpunit"></a>
8+
</p>
9+
<p align=center>
10+
<a href="https://packagist.org/packages/contributte/phpunit"><img src="https://badgen.net/packagist/php/contributte/phpunit"></a>
11+
<a href="https://github.com/contributte/phpunit"><img src="https://badgen.net/github/license/contributte/phpunit"></a>
12+
<a href="https://bit.ly/ctteg"><img src="https://badgen.net/badge/support/gitter/cyan"></a>
13+
<a href="https://bit.ly/cttfo"><img src="https://badgen.net/badge/support/forum/yellow"></a>
14+
<a href="https://contributte.org/partners.html"><img src="https://badgen.net/badge/sponsor/donations/F96854"></a>
15+
</p>
16+
17+
<p align=center>
18+
Website 🚀 <a href="https://contributte.org">contributte.org</a> | Contact 👨🏻‍💻 <a href="https://f3l1x.io">f3l1x.io</a> | Twitter 🐦 <a href="https://twitter.com/contributte">@contributte</a>
19+
</p>
20+
21+
## Usage
22+
23+
To install latest version of `contributte/phpunit` use [Composer](https://getcomposer.org).
24+
25+
```bash
26+
composer require --dev contributte/phpunit
27+
```
28+
29+
## Documentation
30+
31+
For details on how to use this package, check out our [documentation](.docs).
32+
33+
## Versions
34+
35+
| State | Branch | Version | PHP |
36+
|--------|--------|---------|-------|
37+
| dev | master | 0.2.0 | >=8.1 |
38+
| stable | master | 0.1.0 | >=8.1 |
39+
40+
## Development
41+
42+
See [how to contribute](https://contributte.org) to this package. This package is currently maintained by these authors.
43+
44+
<a href="https://github.com/f3l1x">
45+
<img width="80" height="80" src="https://avatars2.githubusercontent.com/u/538058?v=3&s=80">
46+
</a>
47+
48+
-----
49+
50+
Consider to [support](https://contributte.org/partners) **contributte** development team.
51+
Also thank you for using this package.

0 commit comments

Comments
 (0)