Skip to content

Commit 0d057f1

Browse files
author
Michael Petri
committed
Initial commit
0 parents  commit 0d057f1

17 files changed

+5707
-0
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "04:00"
8+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
name: "Continuous Integration"
3+
4+
on:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
matrix:
10+
name: Generate job matrix
11+
runs-on: ubuntu-latest
12+
outputs:
13+
matrix: ${{ steps.matrix.outputs.matrix }}
14+
steps:
15+
- name: Gather CI configuration
16+
id: matrix
17+
uses: laminas/laminas-ci-matrix-action@v1
18+
19+
qa:
20+
name: QA Checks
21+
needs: [matrix]
22+
runs-on: ${{ matrix.operatingSystem }}
23+
strategy:
24+
fail-fast: false
25+
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
26+
steps:
27+
- name: ${{ matrix.name }}
28+
uses: laminas/laminas-continuous-integration-action@v1
29+
with:
30+
job: ${{ matrix.job }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
vendor
2+
.phpunit.result.cache
3+
.php-cs-fixer.cache
4+
.idea
5+
6+
.phpunit-coverage-report

.php-cs-fixer.dist.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests'
7+
]);
8+
9+
return (new PhpCsFixer\Config())
10+
->setRules([
11+
'@PSR12' => true,
12+
'no_unused_imports' => true,
13+
])
14+
->setFinder($finder);

CONTRIBUTE.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing
2+
3+
Contributions are welcome. I accept merge requests on [GitHub][].
4+
This project follows semantic versioning and the [semantic branching model][].
5+
6+
## Communication Channels
7+
8+
You can find help and discussion in the following places:
9+
10+
- [GitHub Issues][issues]
11+
12+
## Reporting Bugs
13+
14+
Bugs get tracked in the project's [issue tracker][issues].
15+
16+
When submitting a bug report, please include enough information to reproduce the
17+
bug. A good bug report includes the following sections:
18+
19+
- Given input
20+
- Expected output
21+
- Actual output
22+
- Steps to reproduce, including sample code
23+
- Any other information that will help debug and reproduce the issue, including
24+
stack traces, system/environment information, screenshots or at best a
25+
merge request with a test scenario which proofs the error.
26+
27+
## Fixing Bugs
28+
29+
I welcome merge requests to fix bugs!
30+
31+
If you see a bug report that you'd like to fix, please feel free to do so.
32+
See the [bug fixes][] section of the [semantic branching model][] documentation.
33+
34+
## Adding New Features
35+
36+
If you have an idea for a new feature, it's a good idea to check out the
37+
[issues][] or active [merge requests][] first to see if the feature has already
38+
requested and being worked on. If not, feel free to submit an issue first, asking
39+
whether the feature is beneficial to the project. This will save you from doing a
40+
lot of development work only to have your feature rejected. I don't enjoy rejecting
41+
your hard work, but some features just don't fit with the goals of the project.
42+
43+
When you do begin working on your feature, here are some guidelines to consider:
44+
45+
- Check the [branch semantics][] section of the [semantic branching model][] documentation.
46+
- Your merge request description should clearly detail the changes you have made.
47+
I will use this description to update the CHANGELOG. If there is no
48+
description, or it does not adequately describe your feature, I will ask you
49+
to update the description.
50+
- This package follows the **[PSR-12 coding standard][psr-12]**. Please
51+
ensure your code does, too.
52+
- Please **write tests** for any new features you add.
53+
- Please **ensure that tests pass** before submitting your merge request.
54+
This package has automatically running tests for merge requests.
55+
However, running the tests locally will help save time.
56+
- Use **feature/{issue-id}.** branches. Please do not ask to merge from your master
57+
branch.
58+
- **Submit one feature per merge request.** If you have multiple features you
59+
wish to submit, please break them up into separate merge requests.
60+
- **Write good commit messages.** Make sure each individual commit in your merge
61+
request is meaningful. If you had to make multiple intermediate commits while
62+
developing, please squash them before submitting.
63+
64+
65+
## Running Tests and Linters
66+
67+
This project contains a composer wrapper script which can be executed with `./composerw` which requires docker.
68+
69+
The following must pass before I will accept a merge request. If this does not
70+
pass, it will result in a complete build failure. Before you can run this, be
71+
sure to `./composerw init`.
72+
73+
To run all the tests and coding standards checks, execute the following from the
74+
command line, while in the project root directory:
75+
76+
```
77+
./composerw lint
78+
./composerw test
79+
```
80+
81+
[GitHub]: https://github.com/michaelpetri/phpunit-consecutive-arguments
82+
[issues]: https://github.com/michaelpetri/phpunit-consecutive-arguments/issues
83+
[bug fixes]: https://dev-cafe.github.io/branching-model#bugfixes
84+
[branch semantics]: https://dev-cafe.github.io/branching-model/#branch-semantics
85+
[merge reqeusts]: https://github.com/michaelpetri/phpunit-consecutive-arguments/compare
86+
[semantic branching model]: https://dev-cafe.github.io/branching-model
87+
[psr-12]: https://www.php-fig.org/psr/psr-12/

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ARG PHP_VERSION
2+
FROM php:${PHP_VERSION}-cli-alpine3.16
3+
4+
# Better extension installer
5+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
6+
RUN chmod +x /usr/local/bin/install-php-extensions
7+
8+
# Install composer
9+
COPY --from=composer:2.4.2 /usr/bin/composer /usr/bin/composer
10+
11+
# Install development tools
12+
RUN apk add --no-cache \
13+
bash \
14+
make \
15+
unzip \
16+
git \
17+
&& install-php-extensions \
18+
xdebug

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Michael Petri
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# PHPUnit Consecutive Arguments
2+
3+
Replacement for the removed InvocationMocker::withConsecutive method.
4+
5+
[![Type Coverage](https://shepherd.dev/github/michaelpetri/phpunit-consecutive-arguments/coverage.svg)](https://shepherd.dev/github/michaelpetri/phpunit-consecutive-arguments)
6+
[![Latest Stable Version](https://poser.pugx.org/michaelpetri/phpunit-consecutive-arguments/v)](https://packagist.org/packages/michaelpetri/phpunit-consecutive-arguments)
7+
[![License](https://poser.pugx.org/michaelpetri/phpunit-consecutive-arguments/license)](https://packagist.org/packages/michaelpetri/phpunit-consecutive-arguments)
8+
9+
## Installation
10+
11+
```shell
12+
composer require michaelpetri/phpunit-consecutive-arguments
13+
```
14+
15+
## Example
16+
17+
```php
18+
$mock
19+
->expects(self::exactly(\count(2)))
20+
->method('someMethod')
21+
->with(
22+
...ConsecutiveArguments::of(
23+
['1.1', '1.2'],
24+
['2.1', '2.2'],
25+
);
26+
```
27+
28+
See [Tests](tests/ConsecutiveArgumentsTest.php) for more examples

composer.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "michaelpetri/phpunit-consecutive-arguments",
3+
"description": "Replacement for the removed InvocationMocker::withConsecutive method.",
4+
"keywords": ["phpunit", "testing"],
5+
"authors": [
6+
{
7+
"name": "Michael Petri",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"license": "MIT",
12+
"require": {
13+
"php": "~8.1.0 || ~8.2.0",
14+
"phpunit/phpunit": "^10.2.6"
15+
},
16+
"require-dev": {
17+
"friendsofphp/php-cs-fixer": "^3.15.1",
18+
"roave/security-advisories": "dev-latest",
19+
"vimeo/psalm": "^5.8.0"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"MichaelPetri\\PhpunitConsecutiveArguments\\": "src/"
24+
}
25+
},
26+
"autoload-dev": {
27+
"psr-4": {
28+
"Tests\\MichaelPetri\\PhpunitConsecutiveArguments\\": "tests/"
29+
}
30+
},
31+
"scripts": {
32+
"lint": [
33+
"@psalm",
34+
"@php-cs-fix",
35+
"@security"
36+
],
37+
"test": [
38+
"@phpunit"
39+
],
40+
"psalm": "vendor/bin/psalm --no-progress",
41+
"psalm-cache-clear": "vendor/bin/psalm --clear-cache",
42+
"psalm-baseline": "vendor/bin/psalm --update-baseline",
43+
"psalm-reset-baseline": "vendor/bin/psalm --set-baseline=psalm-baseline.xml",
44+
"php-cs-fix": "PHP_CS_FIXER_FUTURE_MODE=1 vendor/bin/php-cs-fixer fix --allow-risky=yes",
45+
"security": "composer update --dry-run roave/security-advisories",
46+
"phpunit": "vendor/bin/phpunit --testdox --order-by=random",
47+
"phpunit-coverage-report": "vendor/bin/phpunit --coverage-html=.phpunit-coverage-report",
48+
"bash": "bash"
49+
}
50+
}

0 commit comments

Comments
 (0)