src/DrupalExtension/Context/ContentContext.php
public function assertTranslation($content_type, $title, PyStringNode $string) {
    $values = $this->getYamlParser()->parse($string);
    Assert::keyExists($values, 'langcode', __METHOD__ . ": Required field 'langcode' not found.");

    $nid = $this->getCore()->getEntityIdByLabel('node', $content_type, $title);
    $source = $this->getCore()->entityLoad('node', $nid);

    $this->getCore()->entityAddTranslation($source, $values['langcode'], $values);
  }
public function assertTranslation($content_type, $title, PyStringNode $string) {
    $values = $this->getYamlParser()->parse($string);
    Assert::keyExists($values, 'langcode', __METHOD__ . ": Required field 'langcode' not found.");

    $nid = $this->getCore()->getEntityIdByLabel('node', $content_type, $title);
    $source = $this->getCore()->entityLoad('node', $nid);

    $this->getCore()->entityAddTranslation($source, $values['langcode'], $values);
  }
public function assertTranslation ( $ content_type , $ title , PyStringNode $ string ) { $ values = $ this -> getYamlParser ( ) -> parse ( $ string ) ; Assert :: keyExists ( $ values , 'langcode' , __METHOD__ . ": Required field 'langcode' not found." ) ; $ nid = $ this -> getCore ( ) -> getEntityIdByLabel ( 'node' , $ content_type , $ title ) ; $ source = $ this -> getCore ( ) -> entityLoad ( 'node' , $ nid ) ; $ this -> getCore ( ) -> entityAddTranslation ( $ source , $ values [ 'langcode' ] , $ values ) ; }
Assert translation for given content.

@param string $content_type
The node type for which to add the translation.
@param string $title
The title to identify the content by.
@param \Behat\Gherkin\Node\PyStringNode $string
The text in yaml format that represents the translation.

@Given the following translation for :content_type content :title:
Assert translation for given content .