1,195c1,10 < diff --git a/modules/features_ui/tests/src/Functional/FeaturesBundleUiTest.php b/modules/features_ui/tests/src/Functional/FeaturesBundleUiTest.php < index 6a0efab..9b81aa3 100644 < --- a/modules/features_ui/tests/src/Functional/FeaturesBundleUiTest.php < +++ b/modules/features_ui/tests/src/Functional/FeaturesBundleUiTest.php < @@ -91,14 +91,14 @@ class FeaturesBundleUiTest extends BrowserTestBase { < < // Check initial form. < $this->drupalGet('admin/config/development/features/bundle/_exclude/default'); < - $this->assertFieldChecked('edit-types-config-features-bundle', 'features_bundle is checked'); < - $this->assertNoFieldChecked('edit-types-config-system-simple', 'system_simple is not checked'); < - $this->assertNoFieldChecked('edit-types-config-user-role', 'user_role is not checked'); < - $this->assertFieldChecked('edit-curated', 'curated is checked'); < - $this->assertFieldChecked('edit-module-namespace', 'namespace is checked'); < + $this->assertSession()->checkboxChecked('edit-types-config-features-bundle', 'features_bundle is checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-system-simple', 'system_simple is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-user-role', 'user_role is not checked'); < + $this->assertSession()->checkboxChecked('edit-curated', 'curated is checked'); < + $this->assertSession()->checkboxChecked('edit-module-namespace', 'namespace is checked'); < < // Configure the form. < - $this->drupalPostForm(NULL, [ < + $this->submitForm([ < 'types[config][system_simple]' => TRUE, < 'types[config][user_role]' => FALSE, < 'curated' => TRUE, < @@ -107,11 +107,11 @@ class FeaturesBundleUiTest extends BrowserTestBase { < < // Check form results. < $this->drupalGet('admin/config/development/features/bundle/_exclude/default'); < - $this->assertFieldChecked('edit-types-config-features-bundle', 'Saved, features_bundle is checked'); < - $this->assertFieldChecked('edit-types-config-system-simple', 'Saved, system_simple is checked'); < - $this->assertNoFieldChecked('edit-types-config-user-role', 'Saved, user_role is not checked'); < - $this->assertFieldChecked('edit-curated', 'Saved, curated is checked'); < - $this->assertNoFieldChecked('edit-module-namespace', 'Saved, namespace is not checked'); < + $this->assertSession()->checkboxChecked('edit-types-config-features-bundle', 'Saved, features_bundle is checked'); < + $this->assertSession()->checkboxChecked('edit-types-config-system-simple', 'Saved, system_simple is checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-user-role', 'Saved, user_role is not checked'); < + $this->assertSession()->checkboxChecked('edit-curated', 'Saved, curated is checked'); < + $this->assertSession()->checkboxNotChecked('edit-module-namespace', 'Saved, namespace is not checked'); < < // Check final values. < $settings = $this->defaultBundle()->getAssignmentSettings('exclude'); < @@ -143,19 +143,19 @@ class FeaturesBundleUiTest extends BrowserTestBase { < < // Can we visit the config page with no settings? < $this->drupalGet('admin/config/development/features/bundle/_exclude/default'); < - $this->assertNoFieldChecked('edit-types-config-features-bundle', 'features_bundle is not checked'); < - $this->assertNoFieldChecked('edit-types-config-system-simple', 'system_simple is not checked'); < - $this->assertNoFieldChecked('edit-types-config-user-role', 'user_role is not checked'); < - $this->assertNoFieldChecked('edit-curated', 'curated is not checked'); < - $this->assertNoFieldChecked('edit-module-namespace', 'namespace is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-features-bundle', 'features_bundle is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-system-simple', 'system_simple is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-user-role', 'user_role is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-curated', 'curated is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-module-namespace', 'namespace is not checked'); < < // Can we enable the method? < $this->drupalGet('admin/config/development/features/bundle'); < - $this->assertNoFieldChecked('edit-enabled-exclude', 'Exclude disabled'); < - $this->drupalPostForm(NULL, [ < + $this->assertSession()->checkboxNotChecked('edit-enabled-exclude', 'Exclude disabled'); < + $this->submitForm([ < 'enabled[exclude]' => TRUE, < ], 'Save settings'); < - $this->assertFieldChecked('edit-enabled-exclude', 'Exclude enabled'); < + $this->assertSession()->checkboxChecked('edit-enabled-exclude', 'Exclude enabled'); < < // Check new settings. < $settings = $this->defaultBundle()->getAssignmentSettings('exclude'); < @@ -168,9 +168,10 @@ class FeaturesBundleUiTest extends BrowserTestBase { < < // Can we run assignment with no settings? < $this->drupalGet('admin/config/development/features'); < + $this->drupalGet('admin/config/development/features/bundle/_exclude/default'); < < // Can we configure the method? < - $this->drupalPostForm('admin/config/development/features/bundle/_exclude/default', [ < + $this->submitForm([ < 'types[config][system_simple]' => TRUE, < 'types[config][user_role]' => FALSE, < 'curated' => TRUE, < @@ -179,11 +180,11 @@ class FeaturesBundleUiTest extends BrowserTestBase { < < // Check form results. < $this->drupalGet('admin/config/development/features/bundle/_exclude/default'); < - $this->assertNoFieldChecked('edit-types-config-features-bundle', 'Saved, features_bundle is not checked'); < - $this->assertFieldChecked('edit-types-config-system-simple', 'Saved, system_simple is checked'); < - $this->assertNoFieldChecked('edit-types-config-user-role', 'Saved, user_role is not checked'); < - $this->assertFieldChecked('edit-curated', 'Saved, curated is checked'); < - $this->assertNoFieldChecked('edit-module-namespace', 'Saved, namespace is not checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-features-bundle', 'Saved, features_bundle is not checked'); < + $this->assertSession()->checkboxChecked('edit-types-config-system-simple', 'Saved, system_simple is checked'); < + $this->assertSession()->checkboxNotChecked('edit-types-config-user-role', 'Saved, user_role is not checked'); < + $this->assertSession()->checkboxChecked('edit-curated', 'Saved, curated is checked'); < + $this->assertSession()->checkboxNotChecked('edit-module-namespace', 'Saved, namespace is not checked'); < < // Check final values. < $settings = $this->defaultBundle()->getAssignmentSettings('exclude'); < diff --git a/modules/features_ui/tests/src/Functional/FeaturesCreateUiTest.php b/modules/features_ui/tests/src/Functional/FeaturesCreateUiTest.php < index 27197b6..3fc7233 100644 < --- a/modules/features_ui/tests/src/Functional/FeaturesCreateUiTest.php < +++ b/modules/features_ui/tests/src/Functional/FeaturesCreateUiTest.php < @@ -45,7 +45,7 @@ class FeaturesCreateUiTest extends BrowserTestBase { < $this->drupalPlaceBlock('local_actions_block'); < $this->drupalGet('admin/config/development/features'); < $this->clickLink('Create new feature'); < - $this->assertResponse(200); < + $this->assertSession()->statusCodeEquals(200); < < $edit = [ < 'name' => 'Test feature', < @@ -55,10 +55,10 @@ class FeaturesCreateUiTest extends BrowserTestBase { < 'system_simple[sources][selected][system.theme]' => TRUE, < 'system_simple[sources][selected][user.settings]' => TRUE, < ]; < - $this->drupalPostForm(NULL, $edit, 'Download Archive'); < + $this->submitForm($edit, 'Download Archive'); < < - $this->assertResponse(200); < - $archive = $this->getRawContent(); < + $this->assertSession()->statusCodeEquals(200); < + $archive = $this->getSession()->getPage()->getContent(); < $filename = tempnam($this->tempFilesDirectory, 'feature'); < file_put_contents($filename, $archive); < < @@ -89,12 +89,12 @@ class FeaturesCreateUiTest extends BrowserTestBase { < // Ensure that the features listing renders the right content. < $this->drupalGet('admin/config/development/features'); < $tds = $this->xpath('//table[contains(@class, "features-listing")]/tbody/tr[td[3] = "' . $feature_name . '"]/td'); < - $this->assertLink('Test feature'); < + $this->assertSession()->linkExists('Test feature'); < $this->assertEquals($feature_name, $tds[2]->getText()); < $description_column = $tds[3]->getText(); < $this->assertTrue(strpos($description_column, 'system.theme') !== FALSE); < $this->assertTrue(strpos($description_column, 'user.settings') !== FALSE); < - $this->assertRaw('Test description: giraffe'); < + $this->assertSession()->responseContains('Test description: giraffe'); < $this->assertEquals('Uninstalled', $tds[5]->getText()); < $this->assertEquals('', $tds[6]->getText()); < < @@ -104,7 +104,7 @@ class FeaturesCreateUiTest extends BrowserTestBase { < 'system_simple[included][system.theme]' => FALSE, < 'user_role[sources][selected][authenticated]' => TRUE, < ]; < - $this->drupalPostForm(NULL, $edit, 'Write'); < + $this->submitForm($edit, 'Write'); < $info_filename = $module_path . '/' . $feature_name . '.info.yml'; < < $parsed_info = Yaml::decode(file_get_contents($info_filename)); < @@ -124,7 +124,8 @@ class FeaturesCreateUiTest extends BrowserTestBase { < // Install new feature module. < $edit = []; < $edit['modules[' . $feature_name . '][enable]'] = TRUE; < - $this->drupalPostForm('admin/modules', $edit, 'Install'); < + $this->drupalGet('admin/modules'); < + $this->submitForm($edit, 'Install'); < < // Check that the feature is listed as installed. < $this->drupalGet('admin/config/development/features'); < @@ -143,9 +144,10 @@ class FeaturesCreateUiTest extends BrowserTestBase { < < $tds = $this->xpath('//table[contains(@class, "features-listing")]/tbody/tr[td[3] = "' . $feature_name . '"]/td'); < $this->assertTrue(strpos($tds[6]->getText(), 'Changed') !== FALSE); < + $this->drupalGet('admin/modules/uninstall'); < < // Uninstall the module. < - $this->drupalPostForm('admin/modules/uninstall', ['uninstall[' . $feature_name . ']' => $feature_name], 'Uninstall'); < + $this->submitForm(['uninstall[' . $feature_name . ']' => $feature_name], 'Uninstall'); < $this->submitForm([], 'Uninstall'); < < $this->drupalGet('admin/config/development/features'); < @@ -155,12 +157,13 @@ class FeaturesCreateUiTest extends BrowserTestBase { < < $this->clickLink('Changed'); < $this->drupalGet('admin/config/development/features/diff/' . $feature_name); < - $this->assertRaw('anonymous : Giraffe'); < - $this->assertRaw('anonymous : Anonymous'); < + $this->assertSession()->responseContains('anonymous : Giraffe'); < + $this->assertSession()->responseContains('anonymous : Anonymous'); < < $edit = []; < $edit['modules[' . $feature_name . '][enable]'] = TRUE; < - $this->drupalPostForm('admin/modules', $edit, 'Install'); < + $this->drupalGet('admin/modules'); < + $this->submitForm($edit, 'Install'); < < $this->drupalGet('admin/config/development/features'); < $tds = $this->xpath('//table[contains(@class, "features-listing")]/tbody/tr[td[3] = "' . $feature_name . '"]/td'); < @@ -180,7 +183,7 @@ class FeaturesCreateUiTest extends BrowserTestBase { < $this->assertTrue(strpos($tds[6]->getText(), 'Changed') !== FALSE); < < $this->clickLink('Test feature'); < - $this->drupalPostForm(NULL, [], 'Write'); < + $this->submitForm([], 'Write'); --- > diff --git a/tests/src/Kernel/Entity/FeaturesBundleIntegrationTest.php b/tests/src/Kernel/Entity/FeaturesBundleIntegrationTest.php > index 38b2000..c20234e 100644 > --- a/tests/src/Kernel/Entity/FeaturesBundleIntegrationTest.php > +++ b/tests/src/Kernel/Entity/FeaturesBundleIntegrationTest.php > @@ -15,7 +15,7 @@ class FeaturesBundleIntegrationTest extends KernelTestBase { > /** > * {@inheritdoc} > */ > - public static $modules = ['features']; > + protected static $modules = ['features']; 197,198c12,13 < $this->drupalGet('admin/config/development/features'); < $tds = $this->xpath('//table[contains(@class, "features-listing")]/tbody/tr[td[3] = "' . $feature_name . '"]/td'); --- > /** > * {@inheritDoc} 200c15 < index 948432f..23475ae 100644 --- > index 23475ae..d53d720 100644 203c18 < @@ -57,7 +57,7 @@ class FeaturesAssignTest extends KernelTestBase { --- > @@ -23,7 +23,7 @@ class FeaturesAssignTest extends KernelTestBase { 207,209c22,23 < - protected function setUp() { < + protected function setUp(): void { < parent::setUp(); --- > - public static $modules = ['features', 'node', 'system', 'user', self::TEST_INSTALLED_PACKAGE]; > + protected static $modules = ['features', 'node', 'system', 'user', self::TEST_INSTALLED_PACKAGE]; 211c25,26 < $this->installConfig('features'); --- > /** > * The Feature Manager. 213c28 < index a98c777..24cc219 100644 --- > index 24cc219..7a2e258 100644 216c31 < @@ -20,7 +20,7 @@ class FeaturesAssignerTest extends KernelTestBase { --- > @@ -13,7 +13,7 @@ class FeaturesAssignerTest extends KernelTestBase { 220,224c35,39 < - protected function setUp() { < + protected function setUp(): void { < parent::setUp(); < // We need system.site in order to run $this->configImporter->import(). < $this->installConfig('system'); --- > - public static $modules = ['system', 'config']; > + protected static $modules = ['system', 'config']; > > protected $strictConfigSchema = FALSE; > 226c41 < index 8e40b47..2c4a879 100644 --- > index dad3b48..a46db0d 100644 229c44 < @@ -51,7 +51,7 @@ class FeaturesGenerateTest extends KernelTestBase { --- > @@ -20,7 +20,7 @@ class FeaturesGenerateTest extends KernelTestBase { 233,237c48,52 < - protected function setUp() { < + protected function setUp(): void { < parent::setUp(); < < $this->installConfig('features'); --- > - public static $modules = [ > + protected static $modules = [ > 'features', > 'node', > 'system', 239c54 < index b81e23d..5f60f7d 100644 --- > index 5f60f7d..152723b 100644 242c57 < @@ -36,7 +36,7 @@ class FeaturesManagerKernelTest extends KernelTestBase { --- > @@ -15,7 +15,7 @@ class FeaturesManagerKernelTest extends KernelTestBase { 246,303c61,62 < - protected function setUp() { < + protected function setUp(): void { < parent::setUp(); < < $this->installConfig('features'); < diff --git a/tests/src/Unit/FeaturesBundleTest.php b/tests/src/Unit/FeaturesBundleTest.php < index 07ee199..3725945 100644 < --- a/tests/src/Unit/FeaturesBundleTest.php < +++ b/tests/src/Unit/FeaturesBundleTest.php < @@ -2,6 +2,7 @@ < < namespace Drupal\Tests\features\Unit; < < +use Prophecy\PhpUnit\ProphecyTrait; < use Drupal\features\Entity\FeaturesBundle; < use Drupal\Tests\UnitTestCase; < < @@ -11,10 +12,11 @@ use Drupal\Tests\UnitTestCase; < */ < class FeaturesBundleTest extends UnitTestCase { < < + use ProphecyTrait; < /** < * {@inheritDoc} < */ < - public function setUp() { < + public function setUp(): void { < parent::setUp(); < < // Mock an assigner. < diff --git a/tests/src/Unit/FeaturesManagerTest.php b/tests/src/Unit/FeaturesManagerTest.php < index 640d3ae..23c548e 100644 < --- a/tests/src/Unit/FeaturesManagerTest.php < +++ b/tests/src/Unit/FeaturesManagerTest.php < @@ -2,6 +2,7 @@ < < namespace Drupal\Tests\features\Unit; < < +use Prophecy\PhpUnit\ProphecyTrait; < use Drupal\Component\Serialization\Yaml; < use Drupal\config_update\ConfigDiffInterface; < use Drupal\Core\Config\ConfigFactoryInterface; < @@ -37,6 +38,7 @@ class FeaturesManagerTest extends UnitTestCase { < * The name of the install profile. < */ < const PROFILE_NAME = 'my_profile'; < + use ProphecyTrait; < < /** < * The feature manager interface. < @@ -48,56 +50,56 @@ class FeaturesManagerTest extends UnitTestCase { < /** < * The entity type manager object. < * < - * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $entityTypeManager; --- > - public static $modules = ['system', 'config', 'features']; > + protected static $modules = ['system', 'config', 'features']; 305,358c64 < /** < * The storage interface object. < * < - * @var \Drupal\Core\Config\StorageInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Config\StorageInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $configStorage; < < /** < * The config factory. < * < - * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $configFactory; < < /** < * The config manager. < * < - * @var \Drupal\Core\Config\ConfigManagerInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Config\ConfigManagerInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $configManager; < < /** < * The module handler. < * < - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $moduleHandler; < < /** < * The extension. < * < - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $configReverter; < < /** < * The module extension list mock. < * < - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject < + * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit\Framework\MockObject\MockObject < */ < protected $moduleExtensionList; < < /** < * {@inheritdoc} < */ < - public function setUp() { < + public function setUp(): void { < parent::setUp(); --- > protected $strictConfigSchema = FALSE; 360d65 < $container = new ContainerBuilder();