Skip to content

Commit

Permalink
fix behat paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gseidel committed Jan 12, 2020
1 parent 7db88cd commit b6cb3db
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 58 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -20,7 +20,6 @@
/.web-server-pid
.phpunit
/phpunit.xml
/behat.yml
/npm-debug.log
/yarn-error.log
/assets/theme/custom.scss
20 changes: 10 additions & 10 deletions behat.yml
Expand Up @@ -2,7 +2,7 @@ default:
extensions:
Behat\Symfony2Extension:
kernel:
class: Enhavo\Kernel
class: App\Kernel
bootstrap: features/bootstrap/bootstrap.php

Behat\MinkExtension:
Expand All @@ -12,17 +12,17 @@ default:

formatters:
pretty:
verbose: true
paths: false
verbose: true
paths: false
snippets: false

suites:
enhavo:
contexts:
- Enhavo\Behat\Context\UserContext:
- Enhavo\Behat\Context\EmailContext:
- Enhavo\Behat\Context\MediaContext:
- Enhavo\Behat\Context\DoctrineContext:
- Enhavo\Behat\Context\NavigationContext:
- Enhavo\Behat\Context\SearchContext:
- Behat\MinkExtension\Context\MinkContext
- Enhavo\Bundle\UserBundle\Behat\Context\UserContext:
- Enhavo\Bundle\AppBundle\Behat\Context\EmailContext:
- Enhavo\Bundle\MediaBundle\Behat\Context\MediaContext:
- Enhavo\Bundle\AppBundle\Behat\Context\DoctrineContext:
- Enhavo\Bundle\NavigationBundle\Behat\Context\NavigationContext:
- Enhavo\Bundle\SearchBundle\Behat\Context\SearchContext:
- Behat\MinkExtension\Context\MinkContext:
24 changes: 0 additions & 24 deletions behat.yml.dist

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -11,12 +11,12 @@
],
"autoload": {
"psr-4": {
"": "src/"
"Enhavo\\": "src/Enhavo"
}
},
"autoload-dev": {
"psr-4": {
"": "tests/"
"App\\": "tests/src"
}
},
"require": {
Expand Down
4 changes: 2 additions & 2 deletions src/Enhavo/Bundle/AppBundle/Behat/Context/DoctrineContext.php
Expand Up @@ -6,7 +6,7 @@
* Time: 16:12
*/

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\AppBundle\Behat\Context;


class DoctrineContext extends KernelContext
Expand All @@ -18,4 +18,4 @@ public function iFlushDoctrine()
{
$this->getManager()->flush();
}
}
}
2 changes: 1 addition & 1 deletion src/Enhavo/Bundle/AppBundle/Behat/Context/EmailContext.php
@@ -1,6 +1,6 @@
<?php

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\AppBundle\Behat\Context;

use Behat\Gherkin\Node\PyStringNode;
use Behat\Mink\Exception\UnsupportedDriverActionException;
Expand Down
4 changes: 2 additions & 2 deletions src/Enhavo/Bundle/AppBundle/Behat/Context/HttpContext.php
Expand Up @@ -6,7 +6,7 @@
* Time: 21:53
*/

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\AppBundle\Behat\Context;

use Behat\Gherkin\Node\PyStringNode;
use Behat\Symfony2Extension\Context\KernelAwareContext;
Expand Down Expand Up @@ -120,4 +120,4 @@ public function getRequest()
{
return $this->request;
}
}
}
4 changes: 2 additions & 2 deletions src/Enhavo/Bundle/AppBundle/Behat/Context/KernelContext.php
@@ -1,6 +1,6 @@
<?php

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\AppBundle\Behat\Context;

use Behat\Behat\Context\Context;
use Behat\MinkExtension\Context\RawMinkContext;
Expand Down Expand Up @@ -52,4 +52,4 @@ public function get($id)
{
return $this->getContainer()->get($id);
}
}
}
Expand Up @@ -6,7 +6,7 @@
* Time: 11:58
*/

namespace Enhavo\Bundle\AppBundle\Column\Type;
namespace Enhavo\Bundle\AppBundle\Tests\Column\Type;

use Enhavo\Bundle\AppBundle\Column\Column;
use PHPUnit\Framework\TestCase;
Expand Down
@@ -1,8 +1,9 @@
<?php

namespace Enhavo\Bundle\AppBundle\Column\Type;
namespace Enhavo\Bundle\AppBundle\Tests\Column\Type;

use Enhavo\Bundle\AppBundle\Mock\EntityMock;
use Enhavo\Bundle\AppBundle\Column\Type\BooleanType;
use Enhavo\Bundle\AppBundle\Tests\Mock\EntityMock;

class BooleanTypeTest extends AbstractTypeTest
{
Expand Down
3 changes: 1 addition & 2 deletions src/Enhavo/Bundle/AppBundle/Tests/Mock/EntityMock.php
Expand Up @@ -6,10 +6,9 @@
* @author gseidel
*/

namespace Enhavo\Bundle\AppBundle\Mock;
namespace Enhavo\Bundle\AppBundle\Tests\Mock;

use Sylius\Component\Resource\Model\ResourceInterface;
use PHPUnit\Framework\TestCase;

class EntityMock implements ResourceInterface
{
Expand Down
6 changes: 3 additions & 3 deletions src/Enhavo/Bundle/MediaBundle/Behat/Context/MediaContext.php
Expand Up @@ -6,9 +6,9 @@
* @author gseidel
*/

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\MediaBundle\Behat\Context;

use Enhavo\Bundle\MediaBundle\Content\Content;
use Enhavo\Bundle\AppBundle\Behat\Context\KernelContext;
use Enhavo\Bundle\MediaBundle\Content\ContentInterface;
use Enhavo\Bundle\MediaBundle\Content\PathContent;
use Enhavo\Bundle\MediaBundle\Filter\FilterInterface;
Expand Down Expand Up @@ -91,4 +91,4 @@ public function theImageSizeShouldBePxHeightAndPxWidth($height, $width)
}
}

}
}
Expand Up @@ -6,8 +6,9 @@
* Time: 16:12
*/

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\NavigationBundle\Behat\Context;

use Enhavo\Bundle\AppBundle\Behat\Context\KernelContext;
use Enhavo\Bundle\NavigationBundle\Entity\Node;
use Enhavo\Bundle\PageBundle\Entity\Page;
use PHPUnit\Framework\Assert;
Expand Down Expand Up @@ -74,4 +75,4 @@ public function nodeNavigationObjectContentIdShouldBeSameAsPageNavigationObject(
{
Assert::assertEquals(self::$page->getId(), self::$node->getContentId());
}
}
}
@@ -1,7 +1,8 @@
<?php

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\SearchBundle\Behat\Context;

use Enhavo\Bundle\AppBundle\Behat\Context\KernelContext;
use Enhavo\Bundle\AppBundle\Metadata\MetadataRepository;
use Enhavo\Bundle\PageBundle\Entity\Page;
use Enhavo\Bundle\SearchBundle\Metadata\Metadata;
Expand Down Expand Up @@ -52,4 +53,4 @@ public function theMetadataResultShouldBeOk()
{
Assert::assertInstanceOf(Metadata::class, self::$result);
}
}
}
5 changes: 3 additions & 2 deletions src/Enhavo/Bundle/UserBundle/Behat/Context/UserContext.php
@@ -1,7 +1,8 @@
<?php

namespace Enhavo\Behat\Context;
namespace Enhavo\Bundle\UserBundle\Behat\Context;

use Enhavo\Bundle\AppBundle\Behat\Context\KernelContext;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Behat\Gherkin\Node\TableNode;
Expand Down Expand Up @@ -152,4 +153,4 @@ public function iAmNotLoggedIn()
{
$this->getSession()->restart();
}
}
}
72 changes: 72 additions & 0 deletions tests/src/Kernel.php
@@ -0,0 +1,72 @@
<?php

namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;

class Kernel extends BaseKernel
{
use MicroKernelTrait;

const CONFIG_EXTS = '.{php,xml,yaml,yml}';

public function getCacheDir()
{
return $this->getProjectDir().'/var/cache/'.$this->environment;
}

public function getLogDir()
{
return $this->getProjectDir().'/var/log';
}

public function registerBundles()
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', true);

$confDir = $this->getProjectDir().'/config';

$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');

$confDir = $this->getProjectDir().'/tests/config';

$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}

protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/config';

$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');

$confDir = $this->getProjectDir().'/tests/config';

$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
}

0 comments on commit b6cb3db

Please sign in to comment.