Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -115,10 +115,11 @@ class TestBaseTest extends UnitTestCase {
$mock_test_base = $this->getMockForAbstractClass('Drupal\simpletest\TestBase');
$string = $mock_test_base->randomString($length);
$this->assertEquals($length, strlen($string));
// randomString() should always include an ampersand ('&') if $length is
// greater than 2.
if ($length > 2) {
// randomString() should always include an ampersand ('&') and a
// greater than ('>') if $length is greater than 3.
if ($length > 3) {
$this->assertContains('&', $string);
$this->assertContains('>', $string);
}
}

View file

@ -198,4 +198,41 @@ class WebTestBaseTest extends UnitTestCase {
$this->assertSame($expected, $clicklink_method->invoke($web_test, $label, $index));
}
/**
* @dataProvider providerTestGetAbsoluteUrl
*/
public function testGetAbsoluteUrl($href, $expected_absolute_path) {
$web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
->disableOriginalConstructor()
->setMethods(['getUrl'])
->getMock();
$web_test->expects($this->any())
->method('getUrl')
->willReturn('http://example.com/drupal/current-path?foo=baz');
$GLOBALS['base_url'] = 'http://example.com';
$GLOBALS['base_path'] = 'drupal';
$get_absolute_url_method = new \ReflectionMethod($web_test, 'getAbsoluteUrl');
$get_absolute_url_method->setAccessible(TRUE);
$this->assertSame($expected_absolute_path, $get_absolute_url_method->invoke($web_test, $href));
}
/**
* Provides test data for testGetAbsoluteUrl.
*
* @return array
*/
public function providerTestGetAbsoluteUrl() {
$data = [];
$data['host'] = ['http://example.com/drupal/test-example', 'http://example.com/drupal/test-example'];
$data['path'] = ['/drupal/test-example', 'http://example.com/drupal/test-example'];
$data['path-with-query'] = ['/drupal/test-example?foo=bar', 'http://example.com/drupal/test-example?foo=bar'];
$data['just-query'] = ['?foo=bar', 'http://example.com/drupal/current-path?foo=bar'];
return $data;
}
}