This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » eZ Publish 5 and Behat
expandshrink

eZ Publish 5 and Behat

eZ Publish 5 and Behat

Wednesday 16 October 2013 11:34:08 am - 11 replies

Hello,

I am trying to use Behat and the symfony2 extension of it to do a few functional tests fro a few bundles we are creating.

I ran into a problem with the DB parameters not being recognised and thus getting an exception from the legacy db handler that an empty string is passed in as dbParams.

Anyone has a few pointers on what could be wrong?

 

Kind regards,

Peter

Wednesday 16 October 2013 1:48:11 pm

We have the same issue in the Behat setup in ezpublish-community, I guess it is the one your re using?
Basically SiteAccess is not set so the factory for dbparams can not generate the correct db settings when you try to use the Repository within a FeatureContext.

Jérôme knows more about how this can be done, but there is also examples elsewhere in the kernel for how this be done in ezpublish-community/kernel out of the box basically.

Wednesday 16 October 2013 8:19:23 pm

Hello Andre,

Yeah, I'm using the community version.

I'll dig around in the kernel then and see if I can find out more. Thanks for the pointer, and hopefully Jerome will pop in as well to shed a bit more light on how to get this working with the community version.

Cheers,

Peter

Thursday 17 October 2013 9:10:26 am

Hi, I had the same problem with a Symfony Command, I circumvented it by setting this parameter in my ezpublish.yml file :

parameters:
  ezpublish.siteaccess.default.name: fr

 

Don't know why but it seems the default siteaccess is fetched from this parameter, not from the ezpublish.siteaccess.default_siteaccess config option

Thursday 17 October 2013 9:33:31 am

Hello Benjamin,

Interesting... I'll give that a go as well and see if that helps.

 

Thanks for the reply.

 

Cheers,

Peter

Tuesday 22 October 2013 11:06:12 am

Quote from Benjamin Choquet :

Hi, I had the same problem with a Symfony Command, I circumvented it by setting this parameter in my ezpublish.yml file :

parameters:
  ezpublish.siteaccess.default.name: fr

That doesn't work for me, I get an error:

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]   

  Unrecognized options "default" under "ezpublish.siteaccess.

Tuesday 22 October 2013 12:03:54 pm

I think you didn't declare it in the parameters section but rather in the ezpublish section. It's not the same : parameters are not parsed by configuration component.

Furthermore I'd like to get a statement from eZ on this for my solution is just a dirty hack and I think this parameter should really be generated from config options

Modified on Tuesday 22 October 2013 12:04:14 pm by Benjamin Choquet

Tuesday 22 October 2013 12:56:38 pm

Quote from Benjamin Choquet :

I think you didn't declare it in the parameters section but rather in the ezpublish section. It's not the same : parameters are not parsed by configuration component.

true story
missed  "parameters:"  completely
Thanks Benjamin

However it didn't resolved, still have the same problem as Peter:

 

The value '' that you were trying to assign to parameter 'dbParams' is invalid. Allowed values are: string or array.

Tuesday 22 October 2013 1:50:26 pm

Yeah I was meant to reply that the setting from Benjamin didn't work in my case.

Anyways we dropped behat for now as there were other more pressing matters to address.

We will surely revisit this in the future, but for now it is not critical.

 

It would still be good to get pointers on how to get this to work as I couldn't really see why the settings are not loaded correctly even if I have the test environment specific  config files setup.

Looking at the Kernel it should load them in correctly.

Tuesday 22 October 2013 2:05:22 pm

Hi everyone

Just set EZPUBLISH_SITEACCESS environment variable before launching your behat command:

EZPUBLISH_SITEACCESS="ezdemo_site"
php bin/behat @eZDemoBundle 

Tuesday 22 October 2013 5:32:44 pm

Hi again

I realized that what I propose won't work if you want to play with siteaccess dependent services (such as Repository) in your feature context class.

I made a PR to fix this: https://github.com/ezsystems/ezpublish-community/pull/78

Related issue: https://jira.ez.no/browse/EZP-21633

Modified on Tuesday 22 October 2013 5:33:26 pm by Jérôme Vieilledent

Friday 25 October 2013 11:04:41 am

Hello Jerome,

Thank you for the advice and I am looking forward to try behat out with the fix applied to eZ5.

 

Cheers,

Peter

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from