Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Drupal 8 support #16

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open

Add Drupal 8 support #16

wants to merge 86 commits into from

Conversation

BR0kEN-
Copy link
Owner

@BR0kEN- BR0kEN- commented Dec 30, 2016

Changes

Follow up: #13

Removed methods

  • Drupal\TqExtension\Context\RawTqContext
    • setDrupalVariables(array $variables)
  • Drupal\TqExtension\Utils\EntityDrupalWrapper
    • getFieldInstance($field_name)
    • getFieldInfo($field_name)
    • wrapper($data = null, array $info = [])
  • Drupal\TqExtension\Context\Redirect\RawRedirectContext
    • assertStatusCode($path, $code)

How to use it now

Install

{
  "require": {
    "drupal/tqextension": "dev-drupal-8",
  }
}

Configure

Make sure you have correct version of behat.yml. Declaration of TqExtension there must be placed after DrupalExtension. Example:

Drupal\DrupalExtension:
blackbox: ~
api_driver: drupal
drush:
root: <DRUPAL_PATH>
drupal:
drupal_root: <DRUPAL_PATH>
text:
log_in: Log in
log_out: Log out
username_field: Username
password_field: Password
selectors:
message_selector: .messages
error_message_selector: .messages.error
success_message_selector: .messages.status
warning_message_selector: .messages.warning
region_map:
content: "#content"
sidebar: "#sidebar"
Drupal\TqExtension:
wait_for_email: 10
wait_for_redirect: 60
# email_account_strings: get_account_strings_for_email
# email_accounts:
# example1@email.com:
# imap: imap.gmail.com:993/imap/ssl
# username: example1@email.com
# password: p4sswDstr_1

To do

  • Add tests for DatePicker.

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

@sergiuteaca, this commit e4c2c82 (https://github.com/BR0kEN-/TqExtension/pull/9) 4 breaks Drupal 8 adaptation. Could you remember why you've did it?

@sergiuteaca
Copy link
Contributor

@BR0kEN- because anonymous users were created without UID and this resulted in a fatal error

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

@sergiuteaca I can't imagine how it is possible. Anonymous users cannot be created because they will not be anonymous since uid will be more than 0.

Also take a look at userCreate() method in Drupal\Driver\Cores\Drupal7 or Drupal\Driver\Cores\Drupal8. Here is an example from D8.

  /**
   * {@inheritdoc}
   */
  public function isAuthenticated() {
    return $this->id() > 0;
  }

  /**
   * {@inheritdoc}
   */
  public function isAnonymous() {
    return $this->id() == 0;
  }

Before today I didn't care about that uid => 0 since it always have been replaced by actual ID after creation, but now this line breaks D8 integration and I'm going to get rid from it (actually already did).

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

@sergiuteaca, I want you to provide a failing example/test case, if it will not be difficult to you. I would be thankful.

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

@asgorobets, @Sanchiz, guys, you are welcome to review. Besides changes in this PR there is an interesting point with Travis: build on 5.5 is successful when 5.6 and 7.0 have failed with The page "user/login" is not accessible!.

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

Shit, it fails even with Selenium2 session running on Selenium standalone server. Locally everything is fine using anyone: Goutte or Selenium2.

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Jan 2, 2017

Also, @sergiuteaca, it's not possible to create a user without uid on Drupal 7 using user_save().

Here is the piece of user_save() implementation.

    if (!isset($account->is_new)) {
      $account->is_new = empty($account->uid);
    }

More precisely possible, but with a strange implementation like:

$user->is_new = false;
unset($user->uid);

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Feb 27, 2017

Thanks @arrrtem for testing this!

@BR0kEN-
Copy link
Owner Author

BR0kEN- commented Mar 18, 2017

@AlexNetman the commit above should fix "your" problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants