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 answers only not deleted user 57

Use it for questions about automated Drupal tests.

0 votes
Accepted

Drupal unable to login and logout several accounts in a single functional test

I was able to narrow it down to this block of code in an EventSubscriber: if ($this->currentUser->isAnonymous() && $this->requestStack->getCurrentRequest()->cookies->has('session')) { $options = $th …
Kevin's user avatar
  • 28k
0 votes

Easy way to add Functional or Kernel tests to a View?

I wound up using Drupal Test Traits. The only thing left for me to do is obtain a copy of the database to run the tests in CI, which I can use Drush to grab.
Kevin's user avatar
  • 28k
3 votes
Accepted

Faster phpunit-bootstraping for single Unit-Tests

Kernel and Functional tests are expected to take longer because of a full Drupal bootstrap and site scaffolding per run to test in a clean environment. Unit tests are running raw code and should execu …
Kevin's user avatar
  • 28k
3 votes

PHPUNIT is running successfully on local but giving error on acquia-pipleine

-- To disable deprecation testing completely uncomment the next line. --> <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/> I never have tests fail because of deprecation notices. …
Kevin's user avatar
  • 28k
0 votes

Basic kernel test fails with Type of Drupal\KernelTests\Core\Entity\EntityKernelTestBase::$m...

Looks like my problem stemmed entirely from using the wrong KernelTestBase include. My IDE suggested KernelTestBase as I was typing, and I did not look at the path: use Drupal\Tests\token\Kernel\Kerne …
Kevin's user avatar
  • 28k
0 votes
Accepted

Functional tests report constants are undefined, even if the constant is set in the test or ...

The code in the question only works for Functional tests as they have that method. Lower level kernel and unit tests have no access to that, and thus, they would fail. Instead, I found that you can a …
Kevin's user avatar
  • 28k
0 votes
Accepted

Can't set a default theme in a FunctionalJavascript test with $defaultTheme class property

I wound up installing a barebones install with drush si and exporting certain configuration to an install profile. After adding this to drush si in CI and local, all functional javascript browser test …
Kevin's user avatar
  • 28k
1 vote

Mock a service while running a BrowserTest?

I could not quite get my mocked service to be used from the container as per the docs, so I resulted to doing this. I don't really need a BrowserTest per se, as I just want to ensure the Response obj …
Kevin's user avatar
  • 28k
2 votes
Accepted

Where do I put configuration files for testing?

One way is to create a small testing module that contains specific config you need for a test, then have the test use it as a dependency. …
Kevin's user avatar
  • 28k
1 vote
Accepted

How to write test(s) with specific config to test custom access checks?

Wound up figuring this out I suppose, although I have no idea if this is the proper way. Under the custom module I wanted to test, I created a 'tests' directory with a test module and within that new …
Kevin's user avatar
  • 28k
0 votes
Accepted

Memcache interfering with Simpletest

I wound up creating a new site in Lando and a new site folder just for simpletest. I created a site directory for my main site and moved settings.php into that, and installed a minimal Drupal site to …
Kevin's user avatar
  • 28k
1 vote

Testing strategy, stub, mock, prophecy, what?

The class I am testing only assumes now that a Drupal user object or response from a Netforum call is passed in, or both, making it testable (or, more easy to test) than before. <? … Would love to know more though about how others are testing their own services or classes. …
Kevin's user avatar
  • 28k
4 votes
Accepted

Test fails with custom configuration

Exception Uncaught e ConfigSchemaCheck 86 Drupal\Core\Config\Testing\ConfigSc Drupal\Core\Config\Schema\SchemaIncompleteException: No schema for MODULENAME.settings in Drupal\Core\Config\ … Testing\ConfigSchemaChecker-&gt;onConfigSave() (line 86 of /var/www/docroot/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php). …
Kevin's user avatar
  • 28k
2 votes
Accepted

drupal behat test assert authenticated by role with given fields

You have a typo in your Given condition - you need to have role(s) after administrator. Given I am logged in as a user with the 'administrator' role(s) and I have the following fields:
Kevin's user avatar
  • 28k
0 votes
Accepted

`Drupal\DrupalExtension` extension file or class could not be located

The Drupal Extension requires no modules, only composer installation. Execute: composer require drupal/drupal-extension='~3.0' See the docs for other setup information: https://github.com/jhedstrom/dr …
Kevin's user avatar
  • 28k

15 30 50 per page