Skip to content

Commit 3bfcaa8

Browse files
committed
Initial commit
0 parents  commit 3bfcaa8

35 files changed

+1445
-0
lines changed

.codeclimate.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
engines:
3+
duplication:
4+
enabled: true
5+
fixme:
6+
enabled: true
7+
phpmd:
8+
enabled: true
9+
checks:
10+
CleanCode/StaticAccess:
11+
enabled: false
12+
phan:
13+
enabled: true
14+
config:
15+
file_extensions: "php"
16+
ignore-undeclared: true
17+
ratings:
18+
paths:
19+
- "**.php"
20+
exclude_paths:
21+
- tests/
22+
- vendor/

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and build files with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/tests export-ignore
9+
/phpcs.xml export-ignore
10+
/phpstan.neon export-ignore
11+
/.codeclimate.yml export-ignore
12+
/grumphp.yml export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
/vendor
3+
/composer.lock
4+
/tests/phpunit.xml
5+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
filter:
2+
excluded_paths:
3+
- 'tests/*'
4+
5+
build:
6+
environment:
7+
php: 7.3
8+
tests:
9+
override:
10+
- true
11+
nodes:
12+
analysis:
13+
dependencies:
14+
after:
15+
- vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/ # Scrutinizer does not run composer scripts
16+
tests:
17+
override:
18+
- php-scrutinizer-run
19+
- phpcs-run
20+
21+
tools:
22+
external_code_coverage:
23+
runs: 2 # Scrutinizer will wait for two code coverage submissions (unit and integration test suites)
24+
timeout: 2400 # Timeout in seconds.

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
os: linux
2+
dist: xenial
3+
group: edge
4+
services:
5+
- mysql
6+
addons:
7+
apt:
8+
packages:
9+
- postfix
10+
hosts:
11+
- magento2.travis
12+
language: php
13+
:travis-jobs
14+
env:
15+
global:
16+
- COMPOSER_BIN_DIR=~/bin
17+
- COMPOSER_PACKAGE_NAME=:vendor/:package
18+
cache:
19+
apt: true
20+
directories:
21+
- $HOME/.composer/cache
22+
before_install:
23+
- |
24+
[[ $TEST_SUITE == "unit" ]] || (
25+
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-amd64.deb
26+
sudo dpkg -i --force-confnew elasticsearch-7.6.2-amd64.deb
27+
sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
28+
sudo service elasticsearch restart
29+
)
30+
before_script:
31+
- |
32+
sleep 10
33+
[[ $COVERAGE == "true" ]] || phpenv config-rm xdebug.ini
34+
./.travis/before_script.sh
35+
script: phpunit -c magento2/dev/tests/$TEST_SUITE `[[ $COVERAGE == "true" ]] && echo "--coverage-text --coverage-clover=/tmp/coverage.clover"`
36+
after_script:
37+
- |
38+
[[ $COVERAGE == "true" ]] && wget https://scrutinizer-ci.com/ocular.phar
39+
[[ $COVERAGE == "true" ]] && php ocular.phar code-coverage:upload --format=php-clover /tmp/coverage.clover

.travis/before_script.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
5+
6+
# mock mail
7+
sudo service postfix stop
8+
echo # print a newline
9+
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
10+
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini
11+
12+
# adjust memory limit
13+
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
14+
phpenv rehash;
15+
16+
composer selfupdate
17+
18+
# clone main magento github repository
19+
git clone --branch $MAGENTO_VERSION --depth=1 https://github.com/magento/magento2
20+
21+
# install Magento
22+
cd magento2
23+
24+
# add composer package under test, composer require will trigger update/install
25+
composer config minimum-stability dev
26+
composer config repositories.travis_to_test git https://github.com/${TRAVIS_REPO_SLUG}.git
27+
if [ ! -z $TRAVIS_TAG ]
28+
then
29+
composer require ${COMPOSER_PACKAGE_NAME}:${TRAVIS_TAG}
30+
elif [ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]
31+
then
32+
# For pull requests, use the remote repository
33+
composer config repositories.travis_to_test git https://github.com/${TRAVIS_PULL_REQUEST_SLUG}.git
34+
composer require ${COMPOSER_PACKAGE_NAME}:dev-${TRAVIS_PULL_REQUEST_BRANCH}\#${TRAVIS_PULL_REQUEST_SHA}
35+
else
36+
composer require ${COMPOSER_PACKAGE_NAME}:dev-${TRAVIS_BRANCH}\#${TRAVIS_COMMIT}
37+
fi
38+
39+
# Add tests/src to autoload-dev on project level
40+
php -r '$composer_json = json_decode(file_get_contents("composer.json"), true);
41+
$composer_json["autoload-dev"]["psr-4"][":module-namespace\\:module-name\\"] = "vendor/:vendor/:package/src";
42+
file_put_contents("composer.json", json_encode($composer_json));'
43+
composer dumpautoload
44+
45+
# prepare for test suite
46+
case $TEST_SUITE in
47+
integration)
48+
cp vendor/$COMPOSER_PACKAGE_NAME/tests/integration/phpunit.xml.dist dev/tests/integration/phpunit.xml
49+
50+
cd dev/tests/integration
51+
52+
# create database and move db config into place
53+
mysql -uroot -e '
54+
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
55+
CREATE DATABASE magento_integration_tests;
56+
'
57+
cp etc/install-config-mysql.php.dist etc/install-config-mysql.php
58+
# Remove AMQP configuration
59+
sed -i '/amqp/d' etc/install-config-mysql.php
60+
# Remove default root password
61+
sed -i 's/123123q//' etc/install-config-mysql.php
62+
63+
cd ../../..
64+
;;
65+
unit)
66+
cp vendor/$COMPOSER_PACKAGE_NAME/tests/unit/phpunit.xml.dist dev/tests/unit/phpunit.xml
67+
;;
68+
esac

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
### Added
9+
### Changed
10+
### Removed
11+
### Fixed

CONTRIBUTING.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Contributing to :module-namespace_:module-name
2+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
3+
4+
- Reporting a bug
5+
- Discussing the current state of the code
6+
- Submitting a fix
7+
- Proposing new features
8+
- Becoming a maintainer
9+
10+
## We Develop with Github
11+
We use github to host code, to track issues and feature requests, as well as accept pull requests.
12+
13+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
14+
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
15+
16+
1. Fork the repo and create your branch from `master`.
17+
2. If you've added code that should be tested, add tests.
18+
3. If you've changed APIs, update the documentation.
19+
4. Ensure the test suite passes.
20+
5. Make sure your code lints.
21+
6. Issue that pull request!
22+
23+
## Any contributions you make will be under the MIT Software License
24+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
25+
26+
## Report bugs using Github's [issues](https://github.com/:vendor/:package/issues)
27+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/:vendor/:package/issues/new); it's that easy!
28+
29+
## Write bug reports with detail, background, and sample code
30+
[This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report I wrote, and I think it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408), an app developer whom I greatly respect.
31+
32+
**Great Bug Reports** tend to have:
33+
34+
- A quick summary and/or background
35+
- Steps to reproduce
36+
- Be specific!
37+
- Give sample code if you can. [My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
38+
- What you expected would happen
39+
- What actually happens
40+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
41+
42+
People *love* thorough bug reports. I'm not even kidding.
43+
44+
## Pull Requests
45+
46+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.
47+
48+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
49+
50+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
51+
52+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
53+
54+
- **Create feature branches** - Don't ask us to pull from your master branch.
55+
56+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
57+
58+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
59+
60+
## License
61+
By contributing, you agree that your contributions will be licensed under its MIT License.
62+
63+
## References
64+
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md) with additions from [ThePhpLeague Template](https://github.com/thephpleague/skeleton)

LICENSE

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) :year :company
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: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# ![/>](./dev/favicon.png) integer_net Magento 2 Module Template
2+
3+
This is a GitHub template.
4+
5+
**Create your module now with the "use this template" button:**
6+
7+
[![Use this template](dev/use-this-template.png)](https://github.com/integer-net/magento2-module-template/generate)
8+
9+
After that, clone it on your machine and run `/dev/init` for automatic configuration. For more information, see [dev/README.md](dev/README.md)
10+
11+
<div align="center"><img src="https://www.integer-net.de/wp-content/uploads/2012/11/firmenprofil.jpg" alt="Waschbär Approved Module" /></div>
12+
13+
---
14+
15+
<!-- TEMPLATE -->
16+
17+
# :module-namespace_:module-name Magento Module
18+
<div align="center">
19+
20+
[![Latest Version on Packagist][ico-version]][link-packagist]
21+
[![Software License][ico-license]](LICENSE.md)
22+
[![Build Status][ico-travis]][link-travis]
23+
![Supported Magento Versions][ico-compatibility]
24+
25+
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
26+
[![Quality Score][ico-code-quality]][link-code-quality]
27+
[![Maintainability][ico-maintainability]][link-maintainability]
28+
</div>
29+
30+
---
31+
32+
:description
33+
34+
## Installation
35+
36+
1. Install it into your Magento 2 project with composer:
37+
```
38+
composer require :vendor/:package
39+
```
40+
41+
2. Enable module
42+
```
43+
bin/magento setup:upgrade
44+
```
45+
46+
## Configuration
47+
48+
## Usage
49+
50+
## Changelog
51+
52+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
53+
54+
## Contributing
55+
56+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
57+
58+
## Testing
59+
60+
### Unit Tests
61+
62+
```
63+
vendor/bin/phpunit tests/unit
64+
```
65+
66+
### Magento Integration Tests
67+
68+
0. Configure test database in `dev/tests/integration/etc/install-config-mysql.php`. [Read more in the Magento docs.](https://devdocs.magento.com/guides/v2.4/test/integration/integration_test_execution.html)
69+
70+
1. Copy `tests/integration/phpunit.xml.dist` from the package to `dev/tests/integration/phpunit.xml` in your Magento installation.
71+
72+
2. In that directory, run
73+
``` bash
74+
../../../vendor/bin/phpunit
75+
```
76+
77+
78+
## Security
79+
80+
If you discover any security related issues, please email :author-email instead of using the issue tracker.
81+
82+
## Credits
83+
84+
- [:author-name][link-author]
85+
- [All Contributors][link-contributors]
86+
87+
## License
88+
89+
The MIT License (MIT). Please see [License File](LICENSE) for more information.
90+
91+
[ico-version]: https://img.shields.io/packagist/v/:vendor/:package.svg?style=flat-square
92+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
93+
[ico-travis]: https://img.shields.io/travis/:vendor/:package/master.svg?style=flat-square
94+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/:vendor/:package?style=flat-square
95+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/:vendor/:package.svg?style=flat-square
96+
[ico-maintainability]: https://img.shields.io/codeclimate/maintainability/:vendor/:package?style=flat-square
97+
[ico-compatibility]: https://img.shields.io/badge/magento-:version-badge-brightgreen.svg?logo=magento&longCache=true&style=flat-square
98+
99+
[link-packagist]: https://packagist.org/packages/:vendor/:package
100+
[link-travis]: https://travis-ci.org/:vendor/:package
101+
[link-scrutinizer]: https://scrutinizer-ci.com/g/:vendor/:package/code-structure
102+
[link-code-quality]: https://scrutinizer-ci.com/g/:vendor/:package
103+
[link-maintainability]: https://codeclimate.com/github/:vendor/:package
104+
[link-author]: https://github.com/:author-github
105+
[link-contributors]: ../../contributors

0 commit comments

Comments
 (0)