*
* @var array
*/
- public static $modules = ['test_page_test', 'form_test', 'system_test'];
+ public static $modules = ['test_page_test', 'form_test', 'system_test', 'node'];
/**
* Tests basic page test.
$this->assertSame('header value', $returned_header);
}
+ /**
+ * Tests drupalGet().
+ */
+ public function testDrupalGet() {
+ $this->drupalGet('test-page');
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->addressEquals('test-page');
+ $this->drupalGet('/test-page');
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->addressEquals('test-page');
+ $this->drupalGet('/test-page/');
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->addressEquals('/test-page/');
+ }
+
/**
* Tests basic form functionality.
*/
// Test drupalPostForm() with no-html response.
$values = Json::decode($this->drupalPostForm('form_test/form-state-values-clean', [], t('Submit')));
$this->assertTrue(1000, $values['beer']);
+
+ // Test drupalPostForm() with form by HTML id.
+ $this->drupalCreateContentType(['type' => 'page']);
+ $this->drupalLogin($this->drupalCreateUser(['create page content']));
+ $this->drupalGet('form-test/two-instances-of-same-form');
+ $this->getSession()->getPage()->fillField('edit-title-0-value', 'form1');
+ $this->getSession()->getPage()->fillField('edit-title-0-value--2', 'form2');
+ $this->drupalPostForm(NULL, [], 'Save', [], 'node-page-form--2');
+ $this->assertSession()->pageTextContains('Page form2 has been created.');
}
/**
$this->assertText($sanitized);
// Test getRawContent().
- $this->assertSame($this->getSession()->getPage()->getContent(), $this->getRawContent());
+ $this->assertSame($this->getSession()->getPage()->getContent(), $this->getSession()->getPage()->getContent());
}
/**
$this->assertFieldChecked('edit-checkbox-enabled');
$this->assertNoFieldChecked('edit-checkbox-disabled');
- // Test that the assertion fails correctly with non-existant field id.
+ // Test that the assertion fails correctly with non-existent field id.
try {
$this->assertNoFieldChecked('incorrect_checkbox_id');
$this->fail('The "incorrect_checkbox_id" field was found');
$this->assertEquals([NULL, ['key1' => ['key2' => ['key3' => 3, 'key3.1' => 3.1]]]], $this->minkDefaultDriverArgs);
}
+ /**
+ * Ensures we can't access modules we shouldn't be able to after install.
+ */
+ public function testProfileModules() {
+ $this->setExpectedException(\InvalidArgumentException::class, 'The module demo_umami_content does not exist.');
+ $this->assertFileExists('core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.info.yml');
+ \Drupal::service('extension.list.module')->getPathname('demo_umami_content');
+ }
+
}