Commit 46567172 authored by alexpott's avatar alexpott

Issue #2822837 by vaplas, martin107, chiranjeeb2410, klausi, dawehner: Replace...

Issue #2822837 by vaplas, martin107, chiranjeeb2410, klausi, dawehner: Replace @expectedException @expectedExceptionMessage with $this->setExpectedException
parent 0edd07b2
......@@ -28,13 +28,12 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
* @covers ::processAttachments
*
* @dataProvider nonHtmlResponseProvider
*
* @expectedException \AssertionError
*/
public function testNonHtmlResponse($response_class) {
$big_pipe_response_attachments_processor = $this->createBigPipeResponseAttachmentsProcessor($this->prophesize(AttachmentsResponseProcessorInterface::class));
$non_html_response = new $response_class();
$this->setExpectedException(\AssertionError::class);
$big_pipe_response_attachments_processor->processAttachments($non_html_response);
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\contact\Unit;
use Drupal\contact\MailHandler;
use Drupal\contact\MailHandlerException;
use Drupal\contact\MessageInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface;
......@@ -94,9 +95,6 @@ protected function setUp() {
/**
* Tests the children() method with an invalid key.
*
* @expectedException \Drupal\contact\MailHandlerException
* @expectedExceptionMessage Unable to determine message recipient
*
* @covers ::sendMailMessages
*/
public function testInvalidRecipient() {
......@@ -121,6 +119,7 @@ public function testInvalidRecipient() {
$sender->expects($this->once())
->method('isAnonymous')
->willReturn(FALSE);
$this->setExpectedException(MailHandlerException::class, 'Unable to determine message recipient');
$this->contactMailHandler->sendMailMessages($message, $sender);
}
......
......@@ -160,9 +160,6 @@ public function testCalculateDependencies() {
/**
* Test that invalid bundles are handled.
*
* @expectedException \LogicException
* @expectedExceptionMessage Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.
*/
public function testCalculateDependenciesIncorrectBundle() {
$storage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
......@@ -209,6 +206,7 @@ public function testCalculateDependenciesIncorrectBundle() {
'bundle' => 'test_bundle_not_exists',
'field_type' => 'test_field',
], $this->entityTypeId);
$this->setExpectedException(\LogicException::class, 'Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.');
$field->calculateDependencies();
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\hal\Unit;
use Drupal\hal\Normalizer\FieldItemNormalizer;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
/**
* @coversDefaultClass \Drupal\hal\Normalizer\FieldItemNormalizer
......@@ -17,12 +18,12 @@ class FieldItemNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenorma
* Context for FieldItemNormalizer::denormalize().
*
* @dataProvider providerNormalizerDenormalizeExceptions
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testFieldItemNormalizerDenormalizeExceptions($context) {
$field_item_normalizer = new FieldItemNormalizer();
$data = [];
$class = [];
$this->setExpectedException(InvalidArgumentException::class);
$field_item_normalizer->denormalize($data, $class, NULL, $context);
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\hal\Unit;
use Drupal\hal\Normalizer\FieldNormalizer;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
/**
* @coversDefaultClass \Drupal\hal\Normalizer\FieldNormalizer
......@@ -17,12 +18,12 @@ class FieldNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenormalize
* Context for FieldNormalizer::denormalize().
*
* @dataProvider providerNormalizerDenormalizeExceptions
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testFieldNormalizerDenormalizeExceptions($context) {
$field_item_normalizer = new FieldNormalizer();
$data = [];
$class = [];
$this->setExpectedException(InvalidArgumentException::class);
$field_item_normalizer->denormalize($data, $class, NULL, $context);
}
......
......@@ -4,6 +4,7 @@
use Drupal\language\Plugin\migrate\process\LanguageNegotiation;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
use Drupal\migrate\MigrateException;
/**
* @coversDefaultClass \Drupal\language\Plugin\migrate\process\LanguageNegotiation
......@@ -75,12 +76,10 @@ public function testTransformWithoutWeights() {
/**
* Tests string input.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage The input should be an array
*/
public function testStringInput() {
$this->plugin = new LanguageNegotiation([], 'map', []);
$this->setExpectedException(MigrateException::class, 'The input should be an array');
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -4,6 +4,7 @@
use Drupal\language\Plugin\migrate\process\LanguageTypes;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
use Drupal\migrate\MigrateException;
/**
* @coversDefaultClass \Drupal\language\Plugin\migrate\process\LanguageTypes
......@@ -49,12 +50,10 @@ public function testTransformConfigurable() {
/**
* Tests string input.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage The input should be an array
*/
public function testStringInput() {
$this->plugin = new LanguageTypes([], 'map', []);
$this->setExpectedException(MigrateException::class, 'The input should be an array');
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\locale\Unit;
use Drupal\locale\SourceString;
use Drupal\locale\StringStorageException;
use Drupal\Tests\UnitTestCase;
/**
......@@ -13,22 +14,20 @@ class StringBaseTest extends UnitTestCase {
/**
* @covers ::save
* @expectedException \Drupal\locale\StringStorageException
* @expectedExceptionMessage The string cannot be saved because its not bound to a storage: test
*/
public function testSaveWithoutStorage() {
$string = new SourceString(['source' => 'test']);
$this->setExpectedException(StringStorageException::class, 'The string cannot be saved because its not bound to a storage: test');
$string->save();
}
/**
* @covers ::delete
* @expectedException \Drupal\locale\StringStorageException
* @expectedExceptionMessage The string cannot be deleted because its not bound to a storage: test
*/
public function testDeleteWithoutStorage() {
$string = new SourceString(['lid' => 1, 'source' => 'test']);
$this->setExpectedException(StringStorageException::class, 'The string cannot be deleted because its not bound to a storage: test');
$string->delete();
}
......
......@@ -139,13 +139,10 @@ public function testSuccessfulMoves() {
/**
* Test that non-existent files throw an exception.
*
* @expectedException \Drupal\migrate\MigrateException
*
* @expectedExceptionMessage File '/non/existent/file' does not exist
*/
public function testNonExistentSourceFile() {
$source = '/non/existent/file';
$this->setExpectedException(MigrateException::class, "File '/non/existent/file' does not exist");
$this->doTransform($source, 'public://wontmatter.jpg');
}
......
......@@ -12,6 +12,7 @@
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
......@@ -149,10 +150,10 @@ protected function getSource($configuration = [], $migrate_config = [], $status
/**
* @covers ::__construct
* @expectedException \Drupal\migrate\MigrateException
*/
public function testHighwaterTrackChangesIncompatible() {
$source_config = ['track_changes' => TRUE, 'high_water_property' => ['name' => 'something']];
$this->setExpectedException(MigrateException::class);
$this->getSource($source_config);
}
......
......@@ -27,9 +27,6 @@ class MigrationTest extends UnitTestCase {
* Tests checking requirements for source plugins.
*
* @covers ::checkRequirements
*
* @expectedException \Drupal\migrate\Exception\RequirementsException
* @expectedExceptionMessage Missing source requirement
*/
public function testRequirementsForSourcePlugin() {
$migration = new TestMigration();
......@@ -43,6 +40,7 @@ public function testRequirementsForSourcePlugin() {
$migration->setSourcePlugin($source_plugin);
$migration->setDestinationPlugin($destination_plugin);
$this->setExpectedException(RequirementsException::class, 'Missing source requirement');
$migration->checkRequirements();
}
......@@ -50,9 +48,6 @@ public function testRequirementsForSourcePlugin() {
* Tests checking requirements for destination plugins.
*
* @covers ::checkRequirements
*
* @expectedException \Drupal\migrate\Exception\RequirementsException
* @expectedExceptionMessage Missing destination requirement
*/
public function testRequirementsForDestinationPlugin() {
$migration = new TestMigration();
......@@ -66,6 +61,7 @@ public function testRequirementsForDestinationPlugin() {
$migration->setSourcePlugin($source_plugin);
$migration->setDestinationPlugin($destination_plugin);
$this->setExpectedException(RequirementsException::class, 'Missing destination requirement');
$migration->checkRequirements();
}
......@@ -73,9 +69,6 @@ public function testRequirementsForDestinationPlugin() {
* Tests checking requirements for destination plugins.
*
* @covers ::checkRequirements
*
* @expectedException \Drupal\migrate\Exception\RequirementsException
* @expectedExceptionMessage Missing migrations test_a, test_c
*/
public function testRequirementsForMigrations() {
$migration = new TestMigration();
......@@ -112,6 +105,7 @@ public function testRequirementsForMigrations() {
->with(['test_a', 'test_b', 'test_c', 'test_d'])
->willReturn(['test_b' => $migration_b, 'test_c' => $migration_c, 'test_d' => $migration_d]);
$this->setExpectedException(RequirementsException::class, 'Missing migrations test_a, test_c');
$migration->checkRequirements();
}
......
......@@ -13,6 +13,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
......@@ -84,8 +85,6 @@ public function testImport() {
* Test row skipping when we can't get an entity to save.
*
* @covers ::import
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage Unable to get entity
*/
public function testImportEntityLoadFailure() {
$bundles = [];
......@@ -96,14 +95,12 @@ public function testImportEntityLoadFailure() {
$this->entityManager->reveal(),
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
$destination->setEntity(FALSE);
$this->setExpectedException(MigrateException::class, 'Unable to get entity');
$destination->import(new Row());
}
/**
* Test that translation destination fails for untranslatable entities.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage This entity type does not support translation
*/
public function testUntranslatable() {
// An entity type without a language.
......@@ -125,6 +122,7 @@ public function testUntranslatable() {
$this->entityManager->reveal(),
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
);
$this->setExpectedException(MigrateException::class, 'This entity type does not support translation');
$destination->getIds();
}
......
......@@ -73,20 +73,17 @@ public function testRowWithMultipleSourceIds() {
/**
* Tests object creation: invalid values.
*
* @expectedException \Exception
*/
public function testRowWithInvalidData() {
$invalid_values = [
'title' => 'node X',
];
$this->setExpectedException(\Exception::class);
$row = new Row($invalid_values, $this->testSourceIds);
}
/**
* Tests source immutability after freeze.
*
* @expectedException \Exception
*/
public function testSourceFreeze() {
$row = new Row($this->testValues, $this->testSourceIds);
......@@ -96,18 +93,17 @@ public function testSourceFreeze() {
$row->rehash();
$this->assertSame($this->testHashMod, $row->getHash(), 'Hash changed correctly.');
$row->freezeSource();
$this->setExpectedException(\Exception::class);
$row->setSourceProperty('title', 'new title');
}
/**
* Tests setting on a frozen row.
*
* @expectedException \Exception
* @expectedExceptionMessage The source is frozen and can't be changed any more
*/
public function testSetFrozenRow() {
$row = new Row($this->testValues, $this->testSourceIds);
$row->freezeSource();
$this->setExpectedException(\Exception::class, "The source is frozen and can't be changed any more");
$row->setSourceProperty('title', 'new title');
}
......
......@@ -7,6 +7,7 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\process\Concat;
/**
......@@ -34,10 +35,9 @@ public function testConcatWithoutDelimiter() {
/**
* Test concat fails properly on non-arrays.
*
* @expectedException \Drupal\migrate\MigrateException
*/
public function testConcatWithNonArray() {
$this->setExpectedException(MigrateException::class);
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\process\Extract;
/**
......@@ -29,21 +30,17 @@ public function testExtract() {
/**
* Tests invalid input.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage Input should be an array.
*/
public function testExtractFromString() {
$this->setExpectedException(MigrateException::class, 'Input should be an array.');
$this->plugin->transform('bar', $this->migrateExecutable, $this->row, 'destinationproperty');
}
/**
* Tests unsuccessful extraction.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage Array index missing, extraction failed.
*/
public function testExtractFail() {
$this->setExpectedException(MigrateException::class, 'Array index missing, extraction failed.');
$this->plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\migrate\MigrateSkipProcessException;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\process\Migration;
use Drupal\migrate\Plugin\MigrateDestinationInterface;
......@@ -89,8 +90,6 @@ public function testTransformWithStubbing() {
/**
* Tests that processing is skipped when the input value is empty.
*
* @expectedException \Drupal\migrate\MigrateSkipProcessException
*/
public function testSkipOnEmpty() {
$migration_plugin = $this->prophesize(MigrationInterface::class);
......@@ -102,6 +101,7 @@ public function testSkipOnEmpty() {
];
$migration_plugin->id()->willReturn(uniqid());
$migration = new Migration($configuration, 'migration', [], $migration_plugin->reveal(), $migration_plugin_manager->reveal(), $process_plugin_manager->reveal());
$this->setExpectedException(MigrateSkipProcessException::class);
$migration->transform(0, $this->migrateExecutable, $this->row, 'foo');
}
......
<?php
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateSkipProcessException;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\SkipOnEmpty;
/**
......@@ -13,10 +15,10 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
/**
* @covers ::process
* @expectedException \Drupal\migrate\MigrateSkipProcessException
*/
public function testProcessSkipsOnEmpty() {
$configuration['method'] = 'process';
$this->setExpectedException(MigrateSkipProcessException::class);
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
}
......@@ -33,10 +35,10 @@ public function testProcessBypassesOnNonEmpty() {
/**
* @covers ::row
* @expectedException \Drupal\migrate\MigrateSkipRowException
*/
public function testRowSkipsOnEmpty() {
$configuration['method'] = 'row';
$this->setExpectedException(MigrateSkipRowException::class);
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -2,6 +2,8 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\StaticMap;
/**
......@@ -38,19 +40,17 @@ public function testMapWithSourceList() {
/**
* Tests when the source is empty.
*
* @expectedException \Drupal\migrate\MigrateException
*/
public function testMapwithEmptySource() {
$this->setExpectedException(MigrateException::class);
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'destinationproperty');
}
/**
* Tests when the source is invalid.
*
* @expectedException \Drupal\migrate\MigrateSkipRowException
*/
public function testMapwithInvalidSource() {
$this->setExpectedException(MigrateSkipRowException::class);
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
......@@ -78,15 +78,13 @@ public function testMapWithInvalidSourceWithANullDefaultValue() {
/**
* Tests when the source is invalid and bypass is enabled.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage Setting both default_value and bypass is invalid.
*/
public function testMapWithInvalidSourceAndBypass() {
$configuration['map']['foo']['bar'] = 'baz';
$configuration['default_value'] = 'test';
$configuration['bypass'] = TRUE;
$this->plugin = new StaticMap($configuration, 'map', []);
$this->setExpectedException(MigrateException::class, 'Setting both default_value and bypass is invalid.');
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\process\Substr;
/**
......@@ -55,37 +56,31 @@ public function providerTestSubstr() {
/**
* Tests invalid input type.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage The input value must be a string.
*/
public function testSubstrFail() {
$configuration = [];
$this->plugin = new Substr($configuration, 'map', []);
$this->setExpectedException(MigrateException::class, 'The input value must be a string.');
$this->plugin->transform(['Captain Janeway'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
/**
* Tests that the start parameter is an integer.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.
*/
public function testStartIsString() {
$configuration['start'] = '2';
$this->plugin = new Substr($configuration, 'map', []);
$this->setExpectedException(MigrateException::class, 'The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
/**
* Tests that the length parameter is an integer.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.
*/
public function testLengthIsString() {
$configuration['length'] = '1';
$this->plugin = new Substr($configuration, 'map', []);
$this->setExpectedException(MigrateException::class, 'The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
}
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\serialization\Normalizer\EntityNormalizer;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
/**
* @coversDefaultClass \Drupal\serialization\Normalizer\EntityNormalizer
......@@ -84,10 +85,9 @@ public function testNormalize() {
* Tests the denormalize() method with no entity type provided in context.
*
* @covers ::denormalize
*
* @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
*/
public function testDenormalizeWithNoEntityType() {
$this->setExpectedException(UnexpectedValueException::class);
$this->entityNormalizer->denormalize([], 'Drupal\Core\Entity\ContentEntityBase');
}
......@@ -215,8 +215,6 @@ public function testDenormalizeWithValidBundle() {
/**
* Tests the denormalize method with a bundle property.
*
* @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
*
* @covers ::denormalize
*/
public function testDenormalizeWithInvalidBundle() {
......@@ -288,7 +286,8 @@ public function testDenormalizeWithInvalidBundle() {
->with('test_bundle')
->will($this->returnValue($entity_type_storage));
$this->assertNotNull($this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test']));
$this->setExpectedException(UnexpectedValueException::class);
$this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test']);
}
/**
......
......@@ -10,6 +10,7 @@
use Composer\Autoload\ClassLoader;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\simpletest\Exception\MissingGroupException;
use Drupal\simpletest\TestDiscovery;
use Drupal\Tests\UnitTestCase;
use org\bovigo\vfs\vfsStream;
......@@ -235,8 +236,6 @@ public function infoParserProvider() {
/**
* @covers ::getTestInfo
* @expectedException \Drupal\simpletest\Exception\MissingGroupException
* @expectedExceptionMessage Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest
*/
public function testTestInfoParserMissingGroup() {
$classname = 'Drupal\KernelTests\field\BulkDeleteTest';
......@@ -245,6 +244,7 @@ public function testTestInfoParserMissingGroup() {
* Bulk delete storages and fields, and clean up afterwards.
*/
EOT;
$this->setExpectedException(MissingGroupException::class, 'Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest');
TestDiscovery::getTestInfo($classname, $doc_comment);
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\Tests\system\Kernel\Scripts;
use Drupal\Core\Command\DbCommandBase;
use Drupal\Core\Database\ConnectionNotDefinedException;
use Drupal\Core\Database\Database;
use Drupal\KernelTests\KernelTestBase;
use Symfony\Component\Console\Input\InputInterface;
......@@ -42,8 +43,6 @@ public function testSpecifyDatabaseKey() {
/**
* Invalid database names will throw a useful exception.
*
* @expectedException \Drupal\Core\Database\ConnectionNotDefinedException
*/
public function testSpecifyDatabaseDoesNotExist() {
$command = new DbCommandBaseTester();
......@@ -51,6 +50,7 @@ public function testSpecifyDatabaseDoesNotExist() {
$command_tester->execute([
'--database' => 'dne'
]);
$this->setExpectedException(ConnectionNotDefinedException::class);
$command->getDatabaseConnection($command_tester->getInput());
}
......
......@@ -4,6 +4,7 @@
use Drupal\Tests\UnitTestCase;
use Drupal\user\PrivateTempStore;
use Drupal\user\TempStoreException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
......@@ -121,7 +122,6 @@ public function testGet() {
* Tests the set() method with no lock available.
*
* @covers ::set
* @expectedException \Drupal\user\TempStoreException
*/
public function testSetWithNoLockAvailable() {
$this->lock->expects($this->at(0))
......@@ -139,6 +139,7 @@ public function testSetWithNoLockAvailable() {
$this->keyValue->expects($this->once())
->method('getCollectionName');
$this->setExpectedException(TempStoreException::class);
$this->tempStore->set('test', 'value');