Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use it for questions about automated Drupal tests.
10
votes
Accepted
How to mock a node field value for phpunit?
The following should work using PHPUnit Mock Objects as in your example.
First mock FieldItemListInterface __get magic method.
$fieldDescMock = $this->getMockBuilder('\Drupal\Core\Field\FieldItemLis …
2
votes
Accepted
Proper directory layout for tests
There are three different testing frameworks in Drupal 8.
1. …
2
votes
How to write PHPUnit test for any function that has external dependencies?
The code is dependent on Drupal's service container existing, and thus a container needs to be instantiated and used. This is possible in PHPUnit tests using the \Drupal::setContainer() method, and cr …
1
vote
Accepted
How do I get an instance of AccountInterface in my Unit Test
You most likely want to mock your dependencies rather than trying to instantiate actual objects because a unit test should only test the class it describes. However this is not always as convenient.
…
1
vote
"Button with id|name|label|value "Log in" not found"
Here's what I've found after being annoyed about this over and over again.
SIMPLETEST_BASE_URL should be set to a URL that is resolvable from where phpunit is run.
Inside a container, the hostname …