This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
forked from ma-si/aist-alice-fixtures
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee7be63
Showing
23 changed files
with
1,165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use-sort: | ||
sort-type: alph | ||
sort-direction: asc | ||
|
||
header: | | ||
/** | ||
* AistAliceFixtures (http://mateuszsitek.com/projects/aist-alice-fixtures) | ||
* | ||
* @link http://github.com/ma-si/aist-alice-fixtures for the canonical source repository | ||
* @copyright Copyright (c) 2006-2015 Aist Internet Technologies (http://aist.pl) All rights reserved. | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
phpunit.xml | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
before_install: | ||
- composer self-update | ||
- composer install --prefer-source | ||
|
||
script: | ||
- ./vendor/bin/phpunit | ||
|
||
matrix: | ||
allow_failures: | ||
- php: 7.0 | ||
- php: hhvm | ||
|
||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2006-2015, Aist Internet Technologies | Mateusz Sitek | ||
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 Aist Internet Technologies 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
/** | ||
* AistAliceFixtures (http://mateuszsitek.com/projects/aist-alice-fixtures) | ||
* | ||
* @link http://github.com/ma-si/aist-alice-fixtures for the canonical source repository | ||
* @copyright Copyright (c) 2006-2015 Aist Internet Technologies (http://aist.pl) All rights reserved. | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ | ||
|
||
namespace AistAliceFixtures; | ||
|
||
use Zend\EventManager\EventInterface; | ||
use Zend\ModuleManager\Feature\ConfigProviderInterface; | ||
use Zend\ModuleManager\Feature\InitProviderInterface; | ||
use Zend\ModuleManager\ModuleManagerInterface; | ||
|
||
/** | ||
* AistAliceFixtures Module | ||
*/ | ||
class Module implements ConfigProviderInterface, InitProviderInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getConfig() | ||
{ | ||
return include __DIR__ . '/config/module.config.php'; | ||
} | ||
|
||
public function getAutoloaderConfig() | ||
{ | ||
return [ | ||
'Zend\Loader\ClassMapAutoloader' => [ | ||
__DIR__ . '/autoload_classmap.php', | ||
], | ||
'Zend\Loader\StandardAutoloader' => [ | ||
'namespaces' => [ | ||
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getModuleDependencies() | ||
{ | ||
return [ | ||
'DoctrineModule', | ||
'DoctrineORMModule', | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function init(ModuleManagerInterface $manager) | ||
{ | ||
$events = $manager->getEventManager(); | ||
$events->getSharedManager()->attach('doctrine', 'loadCli.post', [$this, 'initializeConsole']); | ||
} | ||
|
||
/** | ||
* Initializes the console with additional commands from the ORM, DBAL and (optionally) DBAL\Migrations | ||
* | ||
* @param \Zend\EventManager\EventInterface $event | ||
* | ||
* @return void | ||
*/ | ||
public function initializeConsole(EventInterface $event) | ||
{ | ||
/** @var \Symfony\Component\Console\Application $cli */ | ||
$cli = $event->getTarget(); | ||
|
||
/** @var \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator */ | ||
$serviceLocator = $event->getParam('ServiceManager'); | ||
|
||
/** @var \AistAliceFixtures\Tools\Console\Helper\FixtureLoaderHelper $loader */ | ||
$loader = $serviceLocator->get('fixtures.loader'); | ||
|
||
/** @var \AistAliceFixtures\Tools\Console\Helper\FixturePersisterHelper $persister */ | ||
$persister = $serviceLocator->get('fixture.persister'); | ||
|
||
$commands = [ | ||
'aist.fixtures.load', | ||
]; | ||
$cli->addCommands(array_map([$serviceLocator, 'get'], $commands)); | ||
$helperSet = $cli->getHelperSet(); | ||
$helperSet->set($loader, 'loader'); | ||
$helperSet->set($persister, 'persister'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Aist Alice Fixtures | ||
=================== | ||
A Zend Framework 2 Module to help load Doctrine Fixtures with [nelmio/alice](https://github.com/nelmio/alice) and [fzaninotto/Faker](https://github.com/fzaninotto/Faker). | ||
|
||
|
||
## Introduction | ||
Add fixtures to your modules. | ||
|
||
|
||
## Installation | ||
Installation of this module uses composer. | ||
For composer documentation, please refer to [getcomposer.org](http://getcomposer.org/). | ||
|
||
1. Install the module via composer by running: | ||
|
||
```sh | ||
php composer.phar require aist/aist-alice-fixtures | ||
``` | ||
|
||
or download it directly from github and place it in your application's `module/` directory. | ||
2. Add the `AistAliceFixtures` module to the module section of your `config/application.config.php` | ||
## Formatters | ||
This module provides few useful formatters extending faker. Here is a list of the bundled formatters. | ||
### `AistAliceFixtures\Faker\Provider\Internet` extends `Faker\Provider\Internet` | ||
slug // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' | ||
uniDecode // 'Zazolc gesla jazn' | ||
`<slugify('some text')>` allows to pass parameter into slugifier | ||
## Example | ||
Here is a complete example of entity declaration: | ||
```yaml | ||
AistUser\Entity\AistUser: | ||
AistUser_{1..10}: | ||
username: <username()> | ||
fullname: <firstName()> <lastName()> | ||
slug: <slugify(@self->fullname)> | ||
birthDate: <date()> | ||
email: <email()> | ||
``` | ||
## Check list | ||
- [ ] create checklist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* AistAliceFixtures (http://mateuszsitek.com/projects/aist-alice-fixtures) | ||
* | ||
* @link http://github.com/ma-si/aist-alice-fixtures for the canonical source repository | ||
* @copyright Copyright (c) 2006-2015 Aist Internet Technologies (http://aist.pl) All rights reserved. | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ | ||
|
||
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "aist/aist-alice-fixtures", | ||
"description": "Alice Fixtures for ZF2.", | ||
"license": "BSD-3-Clause", | ||
"keywords": [ | ||
"alice", | ||
"fixtures", | ||
"faker", | ||
"zf2", | ||
"developer tools" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "MaSi", | ||
"email": "[email protected]", | ||
"homepage": "http://mateuszsitek.com", | ||
"role": "Author" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0", | ||
"doctrine/doctrine-orm-module": "dev-master", | ||
"fzaninotto/faker": "1.5.*@dev", | ||
"nelmio/alice": "2.0.*@dev", | ||
"bacon/bacon-string-utils": "dev-master" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "4.8.*" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"AistAliceFixtures": "src/" | ||
}, | ||
"classmap": [ | ||
"./Module.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"AistAliceFixturesTest\\": "test/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* AistAliceFixtures (http://mateuszsitek.com/projects/aist-alice-fixtures) | ||
* | ||
* @link http://github.com/ma-si/aist-alice-fixtures for the canonical source repository | ||
* @copyright Copyright (c) 2006-2015 Aist Internet Technologies (http://aist.pl) All rights reserved. | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ | ||
|
||
return [ | ||
'service_manager' => [ | ||
'invokables' => [ | ||
// 'fixtures.loader' => 'Nelmio\Alice\Fixtures\Loader', | ||
], | ||
'factories' => [ | ||
'fixtures.loader' => 'AistAliceFixtures\Service\FixturesLoaderFactory', | ||
'fixture.persister' => 'AistAliceFixtures\Service\FixturesPersisterFactory', | ||
], | ||
], | ||
'fixture_manager' => [ | ||
'commands' => [ | ||
|
||
], | ||
'files' => [ | ||
__DIR__.'/../../data/fixtures/users.yaml', | ||
], | ||
'providers' => [ | ||
|
||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* AistAliceFixtures (http://mateuszsitek.com/projects/aist-alice-fixtures) | ||
* | ||
* @link http://github.com/ma-si/aist-alice-fixtures for the canonical source repository | ||
* @copyright Copyright (c) 2006-2015 Aist Internet Technologies (http://aist.pl) All rights reserved. | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ | ||
|
||
namespace AistAliceFixtures; | ||
|
||
return [ | ||
'service_manager' => [ | ||
'invokables' => [ | ||
// Aist Fixtures Commands | ||
'aist.fixtures.load' => __NAMESPACE__ . '\Tools\Console\Command\Fixtures\LoadCommand', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
backupGlobals = "false" | ||
backupStaticAttributes = "false" | ||
colors = "true" | ||
convertErrorsToExceptions = "true" | ||
convertNoticesToExceptions = "true" | ||
convertWarningsToExceptions = "true" | ||
processIsolation = "false" | ||
stopOnFailure = "false" | ||
syntaxCheck = "false" | ||
bootstrap = "./test/bootstrap.php" > | ||
<testsuites> | ||
<testsuite name="AistAliceFixtures Test Suite"> | ||
<directory>./test/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<groups> | ||
<exclude> | ||
<group>disable</group> | ||
</exclude> | ||
</groups> | ||
|
||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="coverage-html" target="build/coverage" title="Linkania Coverage" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
<log type="coverage-php" target="build/logs/coverage.serialized"/> | ||
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/> | ||
<log type="json" target="build/logs/logfile.json"/> | ||
<log type="tap" target="build/logs/logfile.tap"/> | ||
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/> | ||
<log type="testdox-html" target="build/logs/testdox.html"/> | ||
<log type="testdox-text" target="build/logs/testdox.txt"/> | ||
</logging> | ||
|
||
<php> | ||
<ini name="date.timezone" value="UTC"/> | ||
|
||
<!-- OB_ENABLED should be enabled for some tests to check if all | ||
functionality works as expected. Such tests include those for | ||
Zend\Soap and Zend\Session, which require that headers not be sent | ||
in order to work. --> | ||
<env name="TESTS_ZEND_OB_ENABLED" value="false" /> | ||
|
||
<env name="TESTS_ZEND_FEED_PUBSUBHUBBUB_BASEURI" value="false" /> | ||
<env name="TESTS_ZEND_FEED_READER_ONLINE_ENABLED" value="false" /> | ||
</php> | ||
</phpunit> |
Oops, something went wrong.