Using translations of predefined Behat steps (Phar setting)

I ran some tests with predefined definitions of the Mink extension step. They work as long as they are in English.

Now I have tried the following scenario with German steps:

# language: de
Funktionalität: Demo

  @javascript
  Szenario: Test 1
    Angenommen I am on "/"
    Angenommen ich bin auf "/"
    ...

      

Behat now tells me that the definition of the German pitch is undefined while the English version works.

According to CLI prompt, behat --lang de -dl

should display translated definitions, but it only shows me English ...

What am I doing wrong here?

Edit: Here's a script to rebuild the script. It follows the installation steps from the docs ( http://extensions.behat.org/mink/#through-phar ) in a temp directory and runs a test file of functions.

#!/bin/bash

set -e

TEMPDIR=/tmp/behat-$$
mkdir $TEMPDIR
cd $TEMPDIR

curl http://behat.org/downloads/behat.phar >behat.phar
curl http://behat.org/downloads/mink.phar >mink.phar
curl http://behat.org/downloads/mink_extension.phar >mink_extension.phar

cat >behat.yml <<EOF
default:
  extensions:
    mink_extension.phar:
      mink_loader: 'mink.phar'
      base_url:    'http://behat.org'
      goutte:      ~
EOF

mkdir features
cat >features/test.feature <<EOF
# language: de
Funktionalität: Demo

  Szenario: Öffne Startseite DE + EN
    Angenommen I am on "/"
    Angenommen ich bin auf "/"
EOF

php behat.phar

      

+3


source to share


1 answer


Basically, you haven't done anything wrong.

Although the translation of Behat / Gherkin itself is included in the behat.phar file, the translations of the step definitions from MinkExtension are missing from the mink_extension.phar archive.

It looks like the build script only includes files in MinkExtension / src / without MinkExtension / i18n /. You can open a question for MinkExtension to get this fix.

As a workaround, I suggest installing Behat / Mink using composer instead of working with phar archives.



Create the following composer.json file:

{
    "require": {
        "behat/behat": "2.4.*@stable",
        "behat/mink": "1.4.*@stable",
        "behat/mink-extension": "*",
        "behat/mink-goutte-driver": "*",
        "behat/mink-selenium2-driver": "*"
    },
    "minimum-stability": "dev",
    "config": {
        "bin-dir": "bin/"
    }
}

      

and then install it with:

curl http://getcomposer.org/installer | php
php composer.phar install

      

+4


source







All Articles