Change the way how Doctrine fixtures bundle is initialized & polish README file

This commit is contained in:
Joseph Bielawski 2013-12-20 11:03:25 +01:00
parent 0be169e172
commit 508ebe6a6e
2 changed files with 34 additions and 11 deletions

View file

@ -17,13 +17,20 @@ Documentation is available at [docs.sylius.org](http://docs.sylius.org).
Quick Installation Quick Installation
------------------ ------------------
``` bash ```bash
$ wget http://getcomposer.org/composer.phar $ wget http://getcomposer.org/composer.phar
$ php composer.phar create-project sylius/sylius -s dev $ php composer.phar create-project sylius/sylius -s dev
$ cd sylius $ cd sylius
$ php app/console sylius:install $ php app/console sylius:install
``` ```
To be able to use included fixtures, that make testing and development phases much easier, you may need
to run Composer tool with `--dev` option:
```bash
$ php composer.phar install --dev
```
[Behat](http://behat.org) scenarios [Behat](http://behat.org) scenarios
----------------------------------- -----------------------------------
@ -38,12 +45,12 @@ $ vi behat.yml
Then download [Selenium Server](http://seleniumhq.org/download/), and run it. Then download [Selenium Server](http://seleniumhq.org/download/), and run it.
```bash ```bash
$ java -jar selenium-server-standalone-2.11.0.jar $ java -jar selenium-server-standalone-2.39.0.jar
``` ```
You can run Behat using the following command. You can run Behat using the following command.
``` bash ```bash
$ bin/behat $ bin/behat
``` ```
@ -52,10 +59,10 @@ Troubleshooting
If something goes wrong, errors & exceptions are logged at the application level. If something goes wrong, errors & exceptions are logged at the application level.
```` ```bash
tail -f app/logs/prod.log $ tail -f app/logs/prod.log
tail -f app/logs/dev.log $ tail -f app/logs/dev.log
```` ```
Contributing Contributing
------------ ------------

View file

@ -52,7 +52,6 @@ class AppKernel extends Kernel
// Core bundles. // Core bundles.
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(),
@ -76,10 +75,12 @@ class AppKernel extends Kernel
new Payum\Bundle\PayumBundle\PayumBundle(), new Payum\Bundle\PayumBundle\PayumBundle(),
); );
if (in_array($this->environment, array('dev'))) { if ('dev' === $this->environment) {
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
} }
$bundles = $this->addFixturesBundle($bundles);
return $bundles; return $bundles;
} }
@ -141,10 +142,25 @@ class AppKernel extends Kernel
} }
/** /**
* @return bool * @return boolean
*/ */
private function isVagrantEnvironment() private function isVagrantEnvironment()
{ {
return (getenv('HOME') === '/home/vagrant' || getenv('VAGRANT') === 'VAGRANT') && is_dir('/dev/shm'); return (getenv('HOME') === '/home/vagrant' || getenv('VAGRANT') === 'VAGRANT') && is_dir('/dev/shm');
} }
/**
* @param array $bundles
* @param array $environments
*
* @return array
*/
private function addFixturesBundle(array $bundles, array $environments = array('dev', 'test'))
{
if (in_array($this->environment, $environments) && class_exists('Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle')) {
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}
return $bundles;
}
} }