Skip to main content
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
Results tagged with
Search options questions only not deleted user 46090

Use it for questions about automated Drupal tests.

0 votes
1 answer
159 views

How to define the site to be used in BrowserTestBase on a multisite?

I am working on a multi site where there is no database defined in the default directory, so whenever I run a Functional test extending BrowserTestBase I get the following error: copy(/var/www/drupa …
chap's user avatar
  • 357
4 votes
3 answers
6k views

Unit Testing Mock Guzzle Response

I'm trying to test a method that makes an HTTP request via Guzzle, so I can see if my code that filters that response is working. I have a mock json response in a json file that I want to use to test …
chap's user avatar
  • 357
5 votes
1 answer
1k views

Strategy for unit testing classes that interact with the Entity API

So I end up having to create a partial mock of the class I'm testing. … Browsing through core and contrib modules I notice that there seem to be more Kernel tests than Unit tests, which seems contrary to the testing pyramid Which makes it seem like they have also found …
chap's user avatar
  • 357
2 votes
1 answer
508 views

BrowserTest on a multisite gives an error

My sites directory looks like this: default, site1, site2, site3. The default directory is empty. I want to run tests against my site1 database. So I have put its details in phpunit.xml Here is m …
chap's user avatar
  • 357
0 votes
0 answers
233 views

Issue when trying to create service from ContentEntity subclass and inject into another class

I have a class ApplicationForm that extends ContentEntity. In my other class ApplicationFormForm (Poorly named, I know) I extend ContentEntityForm which in turn inherits from EntityForm. In one of tho …
chap's user avatar
  • 357
2 votes
1 answer
1k views

Dependency Injection while Unit Testing

Now in my testing class I'm already extending the UnitTestCase class, so I don't have access to the create method for dependency injection. <? …
chap's user avatar
  • 357