updated core to 8.6.1 via composer
This commit is contained in:
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- entity_test
|
||||
- drupal:entity_test
|
||||
|
||||
@@ -15,6 +15,7 @@ class MailCaptureTest extends BrowserTestBase {
|
||||
use AssertMailTrait {
|
||||
getMails as drupalGetMails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if the wrapper function is executed correctly.
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ use Drupal\Tests\BrowserTestBase;
|
||||
* Verifies that tests in other installation profiles are found.
|
||||
*
|
||||
* @group simpletest
|
||||
* @see SimpleTestInstallationProfileModuleTestsTestCase
|
||||
* @see \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest
|
||||
*/
|
||||
class OtherInstallationProfileTestsTest extends BrowserTestBase {
|
||||
|
||||
@@ -31,7 +31,7 @@ class OtherInstallationProfileTestsTest extends BrowserTestBase {
|
||||
* @var string
|
||||
*
|
||||
* @see \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest
|
||||
* @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
|
||||
* @see \Drupal\Tests\drupal_system_listing_compatible_test\Kernel\SystemListingCrossProfileCompatibleTest
|
||||
*/
|
||||
protected $profile = 'minimal';
|
||||
|
||||
@@ -60,7 +60,7 @@ class OtherInstallationProfileTestsTest extends BrowserTestBase {
|
||||
|
||||
// Assert the existence of a test for a module in a different installation
|
||||
// profile than the current.
|
||||
$this->assertText('Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest');
|
||||
$this->assertText('Drupal\Tests\drupal_system_listing_compatible_test\Kernel\SystemListingCrossProfileCompatibleTest');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\simpletest\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
|
||||
/**
|
||||
* Tests if we can execute JavaScript in the browser.
|
||||
*
|
||||
* @group javascript
|
||||
*/
|
||||
class BrowserWithJavascriptTest extends JavascriptTestBase {
|
||||
|
||||
public function testJavascript() {
|
||||
$this->drupalGet('<front>');
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->resizeWindow(400, 300);
|
||||
$javascript = <<<JS
|
||||
(function(){
|
||||
var w = window,
|
||||
d = document,
|
||||
e = d.documentElement,
|
||||
g = d.getElementsByTagName('body')[0],
|
||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||
y = w.innerHeight || e.clientHeight|| g.clientHeight;
|
||||
return x == 400 && y == 300;
|
||||
}());
|
||||
JS;
|
||||
$this->assertJsCondition($javascript);
|
||||
}
|
||||
|
||||
public function testAssertJsCondition() {
|
||||
$this->drupalGet('<front>');
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->resizeWindow(500, 300);
|
||||
$javascript = <<<JS
|
||||
(function(){
|
||||
var w = window,
|
||||
d = document,
|
||||
e = d.documentElement,
|
||||
g = d.getElementsByTagName('body')[0],
|
||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||
y = w.innerHeight || e.clientHeight|| g.clientHeight;
|
||||
return x == 400 && y == 300;
|
||||
}());
|
||||
JS;
|
||||
|
||||
// We expected the following assertion to fail because the window has been
|
||||
// re-sized to have a width of 500 not 400.
|
||||
$this->setExpectedException(\PHPUnit_Framework_AssertionFailedError::class);
|
||||
$this->assertJsCondition($javascript, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creating screenshots.
|
||||
*/
|
||||
public function testCreateScreenshot() {
|
||||
$this->drupalGet('<front>');
|
||||
$this->createScreenshot('public://screenshot.jpg');
|
||||
$this->assertFileExists('public://screenshot.jpg');
|
||||
}
|
||||
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\simpletest\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
|
||||
/**
|
||||
* Tests Drupal settings retrieval in JavascriptTestBase tests.
|
||||
*
|
||||
* @group javascript
|
||||
*/
|
||||
class JavascriptGetDrupalSettingsTest extends JavascriptTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = ['test_page_test'];
|
||||
|
||||
/**
|
||||
* Tests retrieval of Drupal settings.
|
||||
*
|
||||
* @see \Drupal\FunctionalJavascriptTests\JavascriptTestBase::getDrupalSettings()
|
||||
*/
|
||||
public function testGetDrupalSettings() {
|
||||
$this->drupalLogin($this->drupalCreateUser());
|
||||
$this->drupalGet('test-page');
|
||||
|
||||
// Check that we can read the JS settings.
|
||||
$js_settings = $this->getDrupalSettings();
|
||||
$this->assertSame('azAZ09();.,\\\/-_{}', $js_settings['test-setting']);
|
||||
|
||||
// Dynamically change the setting using Javascript.
|
||||
$script = <<<EndOfScript
|
||||
(function () {
|
||||
drupalSettings['test-setting'] = 'foo';
|
||||
})();
|
||||
EndOfScript;
|
||||
|
||||
$this->getSession()->evaluateScript($script);
|
||||
|
||||
// Check that the setting has been changed.
|
||||
$js_settings = $this->getDrupalSettings();
|
||||
$this->assertSame('foo', $js_settings['test-setting']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\simpletest\Unit;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Core\File\FileSystemInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -15,6 +16,7 @@ use PHPUnit\Framework\TestCase;
|
||||
* @group simpletest
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class SimpletestPhpunitRunCommandTest extends TestCase {
|
||||
|
||||
@@ -85,6 +87,18 @@ class SimpletestPhpunitRunCommandTest extends TestCase {
|
||||
* @dataProvider provideStatusCodes
|
||||
*/
|
||||
public function testSimpletestPhpUnitRunCommand($status, $label) {
|
||||
// Add a default database connection in order for
|
||||
// Database::getConnectionInfoAsUrl() to return valid information.
|
||||
Database::addConnectionInfo('default', 'default', [
|
||||
'driver' => 'mysql',
|
||||
'username' => 'test_user',
|
||||
'password' => 'test_pass',
|
||||
'host' => 'test_host',
|
||||
'database' => 'test_database',
|
||||
'port' => 3306,
|
||||
'namespace' => 'Drupal\Core\Database\Driver\mysql',
|
||||
]
|
||||
);
|
||||
$test_id = basename(tempnam(sys_get_temp_dir(), 'xxx'));
|
||||
putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
|
||||
$ret = simpletest_run_phpunit_tests($test_id, [SimpletestPhpunitRunCommandTestWillDie::class]);
|
||||
|
||||
@@ -281,6 +281,9 @@ EOF;
|
||||
],
|
||||
'Kernel' => [
|
||||
'KernelExampleTest3.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleTest3', '@group example2'], $test_file),
|
||||
'KernelExampleTestBase.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleTestBase', '@group example2'], $test_file),
|
||||
'KernelExampleTrait.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleTrait', '@group example2'], $test_file),
|
||||
'KernelExampleInterface.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleInterface', '@group example2'], $test_file),
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -385,6 +388,36 @@ EOF;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that classes are not reflected when the docblock is empty.
|
||||
*
|
||||
* @covers ::getTestInfo
|
||||
*/
|
||||
public function testGetTestInfoEmptyDocblock() {
|
||||
// If getTestInfo() performed reflection, it won't be able to find the
|
||||
// class we asked it to analyze, so it will throw a ReflectionException.
|
||||
// We want to make sure it didn't do that, because we already did some
|
||||
// analysis and already have an empty docblock. getTestInfo() will throw
|
||||
// MissingGroupException because the annotation is empty.
|
||||
$this->setExpectedException(MissingGroupException::class);
|
||||
TestDiscovery::getTestInfo('Drupal\Tests\simpletest\ThisTestDoesNotExistTest', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure TestDiscovery::scanDirectory() ignores certain abstract file types.
|
||||
*
|
||||
* @covers ::scanDirectory
|
||||
*/
|
||||
public function testScanDirectoryNoAbstract() {
|
||||
$this->setupVfsWithTestClasses();
|
||||
$files = TestDiscovery::scanDirectory('Drupal\\Tests\\test_module\\Kernel\\', vfsStream::url('drupal/modules/test_module/tests/src/Kernel'));
|
||||
$this->assertNotEmpty($files);
|
||||
$this->assertArrayNotHasKey('Drupal\Tests\test_module\Kernel\KernelExampleTestBase', $files);
|
||||
$this->assertArrayNotHasKey('Drupal\Tests\test_module\Kernel\KernelExampleTrait', $files);
|
||||
$this->assertArrayNotHasKey('Drupal\Tests\test_module\Kernel\KernelExampleInterface', $files);
|
||||
$this->assertArrayHasKey('Drupal\Tests\test_module\Kernel\KernelExampleTest3', $files);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestTestDiscovery extends TestDiscovery {
|
||||
|
||||
Reference in New Issue
Block a user