* cleanup skeleton project files

* fixed entity mapping
* added documentation
This commit is contained in:
Danyi Dávid 2016-08-01 18:33:33 +02:00
parent 2de0bf8add
commit 15fe800840
10 changed files with 130 additions and 878 deletions

View File

@ -2,516 +2,11 @@
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.0.2 - 2016-04-21
## 1.0.0 - 2016-08-01
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#85](https://github.com/zendframework/zend-expressive-skeleton/pull/85)
updates the Aura.Di dependency to stable 3.X versions.
- [#88](https://github.com/zendframework/zend-expressive-skeleton/pull/88)
modifies the installer to remove `composer.lock` from the `.gitignore` file
during initial installation.
- [#89](https://github.com/zendframework/zend-expressive-skeleton/pull/89)
updates the zend-stdlib dependency to allow usage of its v3 series.
## 1.0.1 - 2016-03-17
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#53](https://github.com/zendframework/zend-expressive-skeleton/pull/53)
updates the default Pimple container script such that it now caches factory
instances for re-use.
- [#72](https://github.com/zendframework/zend-expressive-skeleton/pull/72)
updates the `composer.json` to remove the possibility of installing an
Expressive RC version, updates zend-servicemanager to allow using 3.0
versions, and updates whoops to allow either 1.1 or 2.0 versions.
- [#80](https://github.com/zendframework/zend-expressive-skeleton/pull/80)
updates the default ProxyManager constraints to also allow v2 versions.
- [#81](https://github.com/zendframework/zend-expressive-skeleton/pull/81)
fixes an issue in the installer whereby specified constraints were not being
passed to Composer prior to dependency resolution/installation, resulting in
stale dependencies.
- [#78](https://github.com/zendframework/zend-expressive-skeleton/pull/78)
updates the shipped default error templates to remove error/exception display.
Users who really need this functionality can write their own templates; the
project aims to deliver a "safe by default" setting.
## 1.0.0 - 2016-01-28
First stable release.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#69](https://github.com/zendframework/zend-expressive-skeleton/pull/69)
updates the links in templates to point to the new documentation site on
https://zendframework.github.io/zend-expressive/ instead of rtfd.org.
## 1.0.0rc8 - 2016-01-21
Eighth release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#66](https://github.com/zendframework/zend-expressive-skeleton/pull/66)
adds the `'error' => true,` declaration to the `'error'` pipeline middleware
specification.
- [#67](https://github.com/zendframework/zend-expressive-skeleton/pull/67)
updates the `filp/whoops` dependency for installer development to `^1.1 || ^2.0`;
the two are compatible for our use cases, but we should prefer the latest
that can be installed. As 2.0 requires PHP 5.5.9, but our minimum PHP version
is 5.5.0, we must specify both.
## 1.0.0rc7 - 2016-01-19
Seventh release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#64](https://github.com/zendframework/zend-expressive-skeleton/pull/64)
fixes the installer script to correctly rewrite the `require-dev` section
and ensure only the development dependencies selected, as well as base
requirements such as PHPUnit and PHP_CodeSniffer, are installed. As such,
the `--no-dev` flag is no longer required, and development dependencies
such as whoops are properly installed.
## 1.0.0rc6 - 2016-01-19
Sixth release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#56](https://github.com/zendframework/zend-expressive-skeleton/pull/56)
updates the `composer serve` command to include the `public/index.php` script
as an argument. This ensures that asset paths that the application could
intercept and serve will be passed to the application (previously, the
built-in server would treat these as 404s, and never pass them to the
application).
- [#57](https://github.com/zendframework/zend-expressive-skeleton/pull/57)
updates the Apache configuration rules defined in `public/.htaccess` to omit
several that could prevent the application from intercepting requests for
assets.
- [#52](https://github.com/zendframework/zend-expressive-skeleton/pull/52)
fixes the switch statement in the `HomePageAction` class to ensure the
template name and documentation link are accurately found.
- [#59](https://github.com/zendframework/zend-expressive-skeleton/pull/59)
updates the `config/container.php` implementation for zend-servicemanager such
that it can work with either v2 or v3 of that library.
- [#60](https://github.com/zendframework/zend-expressive-skeleton/pull/60)
updates the zend-expressive-helpers dependency to `^2.0`, and updates the
`config/autoload/middleware-pipeline.global.php` to follow the changes in
middleware configuration introduced in [zend-expressive #270](https://github.com/zendframework/zend-expressive/pull/270).
The change introduces convention-based keys for "always" (execute before
routing), "routing" (routing, listeners that act on the route result, and
dispatching), and "error", with reasonable priorities to ensure execution
order.
- [#60](https://github.com/zendframework/zend-expressive-skeleton/pull/60)
fixes the documentation for `composer create-project` to include the
`--no-dev` flag; this is done as composer currently installs the development
dependencies listed before the installer script rewrites the `composer.json`
file. Running `composer update` or `composer install` within the project
directory after the initial installation will install the development
dependencies.
## 1.0.0rc5 - 2015-12-22
Fifth release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#42](https://github.com/zendframework/zend-expressive-skeleton/pull/42)
fixes some grammatical issues in the questions presented by the installer.
- [#45](https://github.com/zendframework/zend-expressive-skeleton/pull/45)
fixes how JS and CSS assets are added to zend-view templates.
- [#48](https://github.com/zendframework/zend-expressive-skeleton/pull/48)
adds unit tests for the `OptionalPackages` class (which provides the Composer
installer scripts).
- [#49](https://github.com/zendframework/zend-expressive-skeleton/pull/49)
updates the Pimple support to Pimple v3, ensuring Pimple users are using the
latest stable release.
## 1.0.0rc4 - 2015-12-09
Fourth release candidate.
### Added
- [#34](https://github.com/zendframework/zend-expressive-skeleton/pull/34)
updates the zend-view configuration to register a factory for
`Zend\View\HelperPluginManager`, as well as a `view_helpers` sub-key for
registering custom view helpers.
- [#37](https://github.com/zendframework/zend-expressive-skeleton/pull/37)
creates the subdirectories `src/App/` and `test/AppTest/`, moving the
subdirectories of each under those, and updating the `composer.json`
autoloading directives accordingly. This change will allow new projects to
implement a "modular" structure if desired, with a subdirectory per namespace.
- [#41](https://github.com/zendframework/zend-expressive-skeleton/pull/41) adds
the composer script "serve", which fires up the built-in PHP webserver on port
8080; invoke using `composer serve`.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#23](https://github.com/zendframework/zend-expressive-skeleton/pull/23)
updates the comment for the glob statements to ensure all 4 (not just 2!)
possible matches are detailed.
- [#24](https://github.com/zendframework/zend-expressive-skeleton/pull/24)
updates the `config/config.php` file to store cached configuration as a plain
PHP file, so that it can simply `include()`; this will be faster than using
JSON-serialized structures.
- [#30](https://github.com/zendframework/zend-expressive-skeleton/pull/30)
updates the Twig configuration to follow the changes made for
[zendframework/zend-expressive-twigrenderer 0.3.0](https://github.com/zendframework/zend-expressive-twigrenderer/releases/tag/0.3.0).
The old configuration format will still work, though users *should* update
their configuration to the new format. The change in this patch only affects
new installs.
- [#33](https://github.com/zendframework/zend-expressive-skeleton/pull/33)
updates to zendframework/zend-expressive-helpers `^1.2`.
- [#33](https://github.com/zendframework/zend-expressive-skeleton/pull/33) adds
configuration for auto-registering the new `Zend\Expressive\Helper\UrlHelperMiddleware`
as pipeline middleware; this fixes an issue when using the zend-view renderer
with the `url()` helper whereby the `UrlHelper` was being registered as a
route result observer too late to receive the `RouteResult`.
- [#40](https://github.com/zendframework/zend-expressive-skeleton/pull/40)
renames the namespace for the installer to `ExpressiveInstaller`.
## 1.0.0rc3 - 2015-12-07
Third release candidate.
### Added
- [#20](https://github.com/zendframework/zend-expressive-skeleton/pull/20) adds
the ability to specify a "minimal" install; when selected, the installer will
install modified configuration, omit some files, and remove the default
middleware and public assets.
- [#27](https://github.com/zendframework/zend-expressive-skeleton/pull/27) adds
[zendframework/zend-expressive-helpers](https://github.com/zendframework/zend-expressive-helpers)
as a dependency, and integrates the helpers into the configuration.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#13](https://github.com/zendframework/zend-expressive-skeleton/pull/13)
updates the installer to also remove the dependency on composer/composer
on completion.
- [#11](https://github.com/zendframework/zend-expressive-skeleton/pull/11)
moves the route middleware service definitions into the routes configuration
files.
- [#21](https://github.com/zendframework/zend-expressive-skeleton/pull/21)
updates `require` statements in generated configuration files to use the
`__DIR__` constant to ensure files are located relative to the origin file.
- [#25](https://github.com/zendframework/zend-expressive-skeleton/pull/25) and
[#29](https://github.com/zendframework/zend-expressive-skeleton/pull/29)
update minimum versions for each router and template implementation (final
versions for RC3 are all at `^1.0`).
- [#29](https://github.com/zendframework/zend-expressive-skeleton/pull/29) sets
the zend-expressive required version to `~1.0.0@rc || ^1.0`, to ensure a
stable version is always installed.
## 1.0.0rc2 - 2015-10-20
Second release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Updated expressive to RC2.
- Updated subcomponent versions in installer to `^0.2`
## 1.0.0rc1 - 2015-10-19
First release candidate.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.5.3 - 2015-10-16
### Added
- [#8](https://github.com/zendframework/zend-expressive-skeleton/pull/8) adds a
routine to the installer that recursively removes the `src/Composer/`
directory of the skeleton, ensuring you have a clean start when creating a
project.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.5.2 - 2015-10-13
### Added
- [#7](https://github.com/zendframework/zend-expressive-skeleton/pull/7) adds a
dependency on zend-stdlib for the purposes of globbing and merging
configuration.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.5.1 - 2015-10-11
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#6](https://github.com/zendframework/zend-expressive-skeleton/pull/6) updates
the zendframework/zend-view package configuration to remove the dependency on
zendframework/zend-i18n, as it is now handled in the standalone
zend-expressive-zendviewrenderer package.
## 0.5.0 - 2015-10-10
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#3](https://github.com/zendframework/zend-expressive-skeleton/pull/3) updates
the skeleton to use zendframework/zend-expressive 0.4.0.
## 0.4.0 - 2015-10-09
First release as zend-expressive-skeleton.
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.3.0 - 2015-09-12
### Added
- Use zend-expressive template factories.
- Use the zend view url helper in the layout template.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.2.0 - 2015-09-11
### Added
- [#bbb2e60](https://github.com/xtreamwayz/expressive-composer-installer/commit/bbb2e607af23e3ae23f6a9c71eb97c3c651c0ca1) adds PHPUnit tests.
- [#791c1c6](https://github.com/xtreamwayz/expressive-composer-installer/commit/791c1c63f324ca08d08e26375f3a356102bf2ad9) adds Whoops error handler.
- [e1d8d7bf](https://github.com/xtreamwayz/expressive-composer-installer/commit/e1d8d7bf5d5e2f51863fa59a37d1963405743201) adds config caching in production mode.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 0.1.1 - 2015-09-08
### Added
- [#b4a0923](https://github.com/xtreamwayz/expressive-composer-installer/commit/b4a092386993227f8057d7ad4e0d9762659eefb0) adds support for Pimple 3.0.x. Still needs testing!
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#11](https://github.com/xtreamwayz/expressive-composer-installer/issues/11) fixes an issues where non stable packages are not being installed correctly.
## 0.1.0 - 2015-09-07
Initial tagged release.
### Added
- Everything.
- Project base.
### Deprecated

View File

@ -1,43 +0,0 @@
# Contributor Code of Conduct
The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com)
as its guidelines for contributor interactions.
## The Code Manifesto
We want to work in an ecosystem that empowers developers to reach their
potential — one that encourages growth and effective collaboration. A space that
is safe for all.
A space such as this benefits everyone that participates in it. It encourages
new developers to enter our field. It is through discussion and collaboration
that we grow, and through growth that we improve.
In the effort to create such a place, we hold to these values:
1. **Discrimination limits us.** This includes discrimination on the basis of
race, gender, sexual orientation, gender identity, age, nationality, technology
and any other arbitrary exclusion of a group of people.
2. **Boundaries honor us.** Your comfort levels are not everyones comfort
levels. Remember that, and if brought to your attention, heed it.
3. **We are our biggest assets.** None of us were born masters of our trade.
Each of us has been helped along the way. Return that favor, when and where
you can.
4. **We are resources for the future.** As an extension of #3, share what you
know. Make yourself a resource to help those that come after you.
5. **Respect defines us.** Treat others as you wish to be treated. Make your
discussions, criticisms and debates from a position of respectfulness. Ask
yourself, is it true? Is it necessary? Is it constructive? Anything less is
unacceptable.
6. **Reactions require grace.** Angry responses are valid, but abusive language
and vindictive actions are toxic. When something happens that offends you,
handle it assertively, but be respectful. Escalate reasonably, and try to
allow the offender an opportunity to explain themselves, and possibly correct
the issue.
7. **Opinions are just that: opinions.** Each and every one of us, due to our
background and upbringing, have varying opinions. The fact of the matter, is
that is perfectly acceptable. Remember this: if you respect your own
opinions, you should respect the opinions of others.
8. **To err is human.** You might not intend it, but mistakes do happen and
contribute to build experience. Tolerate honest mistakes, and don't hesitate
to apologize if you make one yourself.

View File

@ -1,233 +0,0 @@
# CONTRIBUTING
## RESOURCES
If you wish to contribute to Zend Framework, please be sure to
read/subscribe to the following resources:
- [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards)
- [Contributor's Guide](CONTRIBUTING.md)
- ZF Contributor's mailing list:
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
Subscribe: zf-contributors-subscribe@lists.zend.com
- ZF Contributor's IRC channel:
#zftalk.dev on Freenode.net
If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-expressive-skeleton/issues/new).
## Reporting Potential Security Issues
If you have encountered a potential security vulnerability, please **DO NOT** report it on the public
issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead.
We will work with you to verify the vulnerability and patch it as soon as possible.
When reporting issues, please provide the following information:
- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact
We request that you contact us via the email address above and give the project
contributors a chance to resolve the vulnerability and issue a new release prior
to any public exposure; this helps protect users and provides them with a chance
to upgrade and/or update in order to protect their applications.
For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc).
## RUNNING TESTS
To run tests:
- Clone the repository:
```console
$ git clone git@github.com:zendframework/zend-expressive-skeleton.git
$ cd zend-expressive-skeleton
```
- Install dependencies via composer:
```console
$ composer install
```
**NOTE:** If you are wanting to test the installer itself, add the
`--no-scripts` flag to the `composer install` command.
If you don't have `curl` installed, you can also download `composer.phar` from
https://getcomposer.org/:
```console
$ curl -sS https://getcomposer.org/installer | php --
$ ln -s composer.phar composer
```
- Run the tests using the "test" command shipped in the `composer.json`:
```console
$ composer test
```
You can turn on conditional tests with the `phpunit.xml` file.
To do so:
- Copy `phpunit.xml.dist` file to `phpunit.xml`
- Edit `phpunit.xml` to enable any specific functionality you
want to test, as well as to provide test values to utilize.
## Running Coding Standards Checks
First, ensure you've installed dependencies via composer, per the previous
section on running tests.
To run CS checks only:
```console
$ composer cs
```
To attempt to automatically fix common CS issues:
```console
$ composer cs-fix
```
If the above fixes any CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
## Recommended Workflow for Contributions
Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.
1. Setup a [GitHub account](http://github.com/), if you haven't yet
2. Fork the repository (http://github.com/zendframework/zend-expressive-skeleton)
3. Clone the canonical repository locally and enter it.
```console
$ git clone git://github.com:zendframework/zend-expressive-skeleton.git
$ cd zend-expressive-skeleton
```
4. Add a remote to your fork; substitute your GitHub username in the command
below.
```console
$ git remote add {username} git@github.com:{username}/zend-expressive-skeleton.git
$ git fetch {username}
```
### Keeping Up-to-Date
Periodically, you should update your fork or personal repository to
match the canonical ZF repository. Assuming you have setup your local repository
per the instructions above, you can do the following:
```console
$ git checkout master
$ git fetch origin
$ git rebase origin/master
# OPTIONALLY, to keep your remote up-to-date -
$ git push {username} master:master
```
If you're tracking other branches -- for example, the "develop" branch, where
new feature development occurs -- you'll want to do the same operations for that
branch; simply substitute "develop" for "master".
### Working on a patch
We recommend you do each new feature or bugfix in a new branch. This simplifies
the task of code review as well as the task of merging your changes into the
canonical repository.
A typical workflow will then consist of the following:
1. Create a new local branch based off either your master or develop branch.
2. Switch to your new local branch. (This step can be combined with the
previous step with the use of `git checkout -b`.)
3. Do some work, commit, repeat as necessary.
4. Push the local branch to your remote repository.
5. Send a pull request.
The mechanics of this process are actually quite trivial. Below, we will
create a branch for fixing an issue in the tracker.
```console
$ git checkout -b hotfix/9295
Switched to a new branch 'hotfix/9295'
```
... do some work ...
```console
$ git commit
```
... write your log message ...
```console
$ git push {username} hotfix/9295:hotfix/9295
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compression objects: 100% (18/18), done.
Writing objects: 100% (20/20), 8.19KiB, done.
Total 20 (delta 12), reused 0 (delta 0)
To ssh://git@github.com/{username}/zend-expressive-skeleton.git
b5583aa..4f51698 HEAD -> master
```
To send a pull request, you have two options.
If using GitHub, you can do the pull request from there. Navigate to
your repository, select the branch you just created, and then select the
"Pull Request" button in the upper right. Select the user/organization
"zendframework" as the recipient.
If using your own repository - or even if using GitHub - you can use `git
format-patch` to create a patchset for us to apply; in fact, this is
**recommended** for security-related patches. If you use `format-patch`, please
send the patches as attachments to:
- zf-devteam@zend.com for patches without security implications
- zf-security@zend.com for security patches
#### What branch to issue the pull request against?
Which branch should you issue a pull request against?
- For fixes against the stable release, issue the pull request against the
"master" branch.
- For new features, or fixes that introduce new elements to the public API (such
as new public methods or properties), issue the pull request against the
"develop" branch.
### Branch Cleanup
As you might imagine, if you are a frequent contributor, you'll start to
get a ton of branches both locally and on your remote.
Once you know that your changes have been accepted to the master
repository, we suggest doing some cleanup of these branches.
- Local branch cleanup
```console
$ git branch -d <branchname>
```
- Remote branch removal
```console
$ git push {username} :<branchname>
```
## Conduct
Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project.

View File

@ -1,12 +0,0 @@
Copyright (c) 2015, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,88 +1,38 @@
# Expressive Skeleton and Installer
[![Build Status](https://secure.travis-ci.org/zendframework/zend-expressive-skeleton.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-expressive-skeleton)
*Begin developing PSR-7 middleware applications in seconds!*
[zend-expressive](https://github.com/zendframework/zend-expressive) builds on
[zend-stratigility](https://github.com/zendframework/zend-stratigility) to
provide a minimalist PSR-7 middleware framework for PHP with routing, DI
container, optional templating, and optional error handling capabilities.
This installer will setup a skeleton application based on zend-expressive by
choosing optional packages based on user input as demonstrated in the following
screenshot:
![screenshot-installer](https://cloud.githubusercontent.com/assets/459648/10410494/16bdc674-6f6d-11e5-8190-3c1466e93361.png)
The user selected packages are saved into `composer.json` so that everyone else
working on the project have the same packages installed. Configuration files and
templates are prepared for first use. The installer command is removed from
`composer.json` after setup succeeded, and all installer related files are
removed.
# SIMEN backend example
## Getting Started
Start your new Expressive project with composer:
Install [composer](https://getcomposer.org/) in your path, then clone the repository
```bash
$ composer create-project zendframework/zend-expressive-skeleton <project-path>
$ git clone http://gogs.ragnarok.yvan.hu/SIMEN/simen-backend-zf3mw.git simen-backend
```
After choosing and installing the packages you want, go to the
`<project-path>` and start PHP's built-in web server to verify installation:
Install the dependencies
```bash
$ composer serve
$ composer install
```
You can then browse to http://localhost:8080.
> ### Setting a timeout
>
> Composer commands time out after 300 seconds (5 minutes). On Linux-based
> systems, the `php -S` command that `composer server` spawns continues running
> as a background process, but on other systems halts when the timeout occurs.
>
> If you want the server to live longer, you can use the
> `COMPOSER_PROCESS_TIMEOUT` environment variable when executing `composer
> serve` to extend the timeout. As an example, the following will extend it
> to a full day:
>
> ```bash
> $ COMPOSER_PROCESS_TIMEOUT=86400 composer serve
> ```
## Troubleshooting
If the installer fails during the ``composer create-project`` phase, please go
through the following list before opening a new issue. Most issues we have seen
so far can be solved by `self-update` and `clear-cache`.
1. Be sure to work with the latest version of composer by running `composer self-update`.
2. Try clearing Composer's cache by running `composer clear-cache`.
If neither of the above help, you might face more serious issues:
- Info about the [zlib_decode error](https://github.com/composer/composer/issues/4121).
- Info and solutions for [composer degraded mode](https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode).
## Skeleton Development
This section applies only if you cloned this repo with `git clone`, not when you
installed expressive with `composer create-project ...`.
If you want to run tests against the installer, you need to clone this repo and
setup all dependencies with composer. Make sure you **prevent composer running
scripts** with `--no-scripts`, otherwise it will remove the installer and all
tests.
Set up your webserver to point to the public folder of the project
Create a copy of the default doctrine configuration template:
```bash
$ composer install --no-scripts
$ composer test
$ cp config/autoload/doctrine.local.dist.php config/autoload/doctrine.local.php
```
Please note that the installer tests remove installed config files and templates
before and after running the tests.
Edit `doctrine.local.php` and set up your database connection.
Before contributing read [the contributing guide](CONTRIBUTING.md).
> You can do the same with `errorhandler.local.dist.php` if you want to set up a fancy error handler
In development you can install the initial database with
```bash
$ vendor/bin/doctrine orm:schema-tool:create
```
API endpoints are:
* list all: HTTP GET /api/article
* get one: HTTP GET /api/article/:id
* insert: HTTP POST /api/article
* update: HTTP PUT /api/article/:id
* delete: HTTP DELETE /api/article/:id

View File

@ -53,6 +53,7 @@
"cs": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8080 -t public/ public/index.php",
"test": "phpunit"
"test": "phpunit",
"doctrine": "doctrine"
}
}

View File

@ -43,8 +43,8 @@ class Article implements JsonSerializable
private $author = null;
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="author")
* @ORM\JoinColumn(name="id", referencedColumnName="author_id", nullable=false)
* @ORM\OneToMany(targetEntity="Comment", mappedBy="article")
* @ORM\JoinColumn(name="id", referencedColumnName="article_id", nullable=false)
* @var Comment[]
*/
private $comments;

View File

@ -0,0 +1,48 @@
<?php
namespace AppTest\Action\Article;
use App\Action\Article\DeleteAction;
use App\Service\Article\ArticleService;
use App\Service\EntityServiceInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequest;
class DeleteActionTest extends \PHPUnit_Framework_TestCase
{
/** @var EntityServiceInterface */
protected $entityService;
protected function setUp()
{
$this->entityService = $this->prophesize(ArticleService::class);
$this->entityService->willImplement(EntityServiceInterface::class);
$this->entityService->delete(1)->willReturn(true);
$this->entityService->delete(10)->willReturn(false);
}
public function testCanDelete()
{
$page = new DeleteAction($this->entityService->reveal());
$request = new ServerRequest();
$response = $page($request->withAttribute('id', 1), new Response(), function () {
});
$this->assertTrue($response instanceof Response);
$this->assertEquals('true', $response->getBody()->getContents());
}
public function testCantDelete()
{
$page = new DeleteAction($this->entityService->reveal());
$request = new ServerRequest();
$response = $page($request->withAttribute('id', 10), new Response(), function () {
});
$this->assertTrue($response instanceof Response);
$this->assertEquals('false', $response->getBody()->getContents());
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace AppTest\Action\Article;
use App\Action\Article\DeleteAction;
use App\Action\Article\DeleteFactory;
use App\Service\Article\ArticleService;
use Interop\Container\ContainerInterface;
use Zend\Expressive\Template\TemplateRendererInterface;
class DeleteFactoryTest extends \PHPUnit_Framework_TestCase
{
/** @var ContainerInterface */
protected $container;
protected function setUp()
{
$this->container = $this->prophesize(ContainerInterface::class);
$articleService = $this->prophesize(ArticleService::class);
$this->container->get(ArticleService::class)->willReturn($articleService);
}
public function testFactoryWithoutTemplate()
{
$factory = new DeleteFactory();
$this->container->has(TemplateRendererInterface::class)->willReturn(false);
$this->assertTrue($factory instanceof DeleteFactory);
$page = $factory($this->container->reveal());
$this->assertTrue($page instanceof DeleteAction);
}
public function testFactoryWithTemplate()
{
$factory = new DeleteFactory();
$this->container->has(TemplateRendererInterface::class)->willReturn(true);
$this->container
->get(TemplateRendererInterface::class)
->willReturn($this->prophesize(TemplateRendererInterface::class));
$this->assertTrue($factory instanceof DeleteFactory);
$homePage = $factory($this->container->reveal());
$this->assertTrue($homePage instanceof DeleteAction);
}
}

View File

@ -3,7 +3,6 @@
namespace AppTest\Action\Article;
use App\Action\Article\ListAction;
use App\Entity\User;
use App\Service\Article\ArticleService;
use App\Service\EntityServiceInterface;
use Zend\Diactoros\Response;
@ -17,13 +16,9 @@ class ListActionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$user = new User();
$entityService = $this->prophesize(ArticleService::class);
$entityService->willImplement(EntityServiceInterface::class);
$entityService->getList()->willReturn([]);
$this->entityService = $entityService;
$this->entityService = $this->prophesize(ArticleService::class);
$this->entityService->willImplement(EntityServiceInterface::class);
$this->entityService->getList()->willReturn([]);
}
public function testResponse()