space-monkeys / common-bundle
Bundle with commonly used components for Symfony / Sulu CMS projects.
Installs: 2 781
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^5.6 || ^7.0
- symfony/framework-bundle: ^2.8 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.7
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^1.0
This package is not auto-updated.
Last update: 2019-01-17 15:27:37 UTC
README
Bundle with commonly used components for Symfony / Sulu CMS projects.
Installation using Composer
Run the following command to add the package to the composer.json of your project:
$ composer require space-monkeys/common-bundle
Enable the bundle
Enable the bundle in the kernel:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new SpaceMonkeys\CommonBundle\SpaceMonkeysCommonBundle(), // ... ); }
Usage
Testing components
To make use of the testing components you extend your PHPUnit test cases from SpaceMonkeys\CommonBundle\Testing\AbstractWebTestCase
.
This will create a client to execute requests and the database utility to clear SQL and/or Elasticsearch database.
The PHPUnit configuration requires the following configuration parameters:
<?xml version='1.0' encoding='UTF-8'?> <phpunit> <!-- ... --> <php> <server name='KERNEL_CLASS' value='YourKernelClassName'/> <server name='APP_ENV' value='test'/> <server name='TESTSUITE_CONTAINER_ELASTICSEARCH_CLIENT_ID' value='service_id.of.elasticsearch.client'/><!-- optional --> <server name='TESTSUITE_CONTAINER_PARAMETER_INDEX_NAME' value='parameter.name.of.elasticsearch.index.name'/><!-- optional --> <server name='TESTSUITE_CONTAINER_PARAMETER_INDEX_SETTINGS' value='parameter.name.of.elasticsearch.index.settings'/><!-- optional --> <server name='TESTSUITE_CONTAINER_PARAMETER_INDEX_MAPPINGS' value='parameter.name.of.elasticsearch.index.mappings'/><!-- optional --> </php> <!-- ... --> </phpunit>