<?php

use Behat\Gherkin\Node\PyStringNode;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use PHPUnit\Framework\Assert;
use Drupal\user\Entity\Role;
use Behat\Gherkin\Node\TableNode;
use Drupal\node\Entity\NodeType;
use Drupal\media\Entity\MediaType;
use Drupal\block_content\Entity\BlockContentType;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends RawDrupalContext
{
  /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
  public function __construct()
  {
  }

  /**
     * @Then the response status code should be :arg1
     */
  public function theResponseStatusCodeShouldBe($arg1)
  {
    throw new PendingException();
  }

  /**
   * @Given the :arg1 content type exists
   *
   * Examples:
   * Given the "blog" content type exists
   *
   * @throws \Exception;
   */
  public function contentTypeExists($string) {
    $node_type = NodeType::load($string);
    if (empty($node_type)) {
      throw new \Exception('Content type ' . $string . ' does not exist.');
    }
  }

  /**
     * @Given I am logged in as a user with the :arg1 role
     */
  public function iAmLoggedInAsAUserWithTheRole($arg1)
  {
    throw new PendingException();
  }

  /**
     * @Given I am on :arg1
     */
  public function iAmOn($arg1)
  {
    throw new PendingException();
  }

  /**
     * @Then I should see the link :arg1 in the :arg2 region
     */
  public function iShouldSeeTheLinkInTheRegion($arg1, $arg2)
  {
    throw new PendingException();
  }

  /**
     * @Given I am not logged in
     */
  public function iAmNotLoggedIn()
  {
    throw new PendingException();
  }
}
