Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -90,12 +90,13 @@ class ViewAjaxControllerTest extends UnitTestCase {
$this->viewAjaxController = new ViewAjaxController($this->viewStorage, $this->executableFactory, $this->renderer, $this->currentPath, $this->redirectDestination);
$element_info_manager = $this->getMock('\Drupal\Core\Render\ElementInfoManagerInterface');
$request_stack = new RequestStack();
$request_stack->push(new Request());
$args = [
$this->getMock('\Drupal\Core\Controller\ControllerResolverInterface'),
$this->getMock('\Drupal\Core\Theme\ThemeManagerInterface'),
$this->getMock('\Drupal\Core\Render\ElementInfoManagerInterface'),
$element_info_manager,
$this->getMock('\Drupal\Core\Render\RenderCacheInterface'),
$request_stack,
[

View file

@ -930,13 +930,10 @@ class TestEntityType extends EntityType {
}
namespace {
use Drupal\Component\Utility\SafeMarkup;
if (!function_exists('t')) {
function t($string, array $args = []) {
return SafeMarkup::format($string, $args);
return strtr($string, $args);
}
}
}

View file

@ -141,7 +141,7 @@ class ViewsBlockTest extends UnitTestCase {
*/
public function testBuild() {
$output = $this->randomMachineName(100);
$build = array('#markup' => $output, '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block');
$build = array('view_build' => $output, '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block', '#pre_rendered' => TRUE);
$this->executable->expects($this->once())
->method('buildRenderable')
->with('block_1', [])
@ -157,6 +157,28 @@ class ViewsBlockTest extends UnitTestCase {
$this->assertEquals($build, $plugin->build());
}
/**
* Tests the build method.
*
* @covers ::build
*/
public function testBuildEmpty() {
$build = ['view_build' => [], '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block', '#pre_rendered' => TRUE, '#cache' => ['contexts' => ['user']]];
$this->executable->expects($this->once())
->method('buildRenderable')
->with('block_1', [])
->willReturn($build);
$block_id = 'views_block:test_view-block_1';
$config = [];
$definition = [];
$definition['provider'] = 'views';
$plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account);
$this->assertEquals(array_intersect_key($build, ['#cache' => TRUE]), $plugin->build());
}
/**
* Tests the build method with a failed execution.
*

View file

@ -7,7 +7,6 @@
namespace Drupal\Tests\views\Unit\Plugin\field;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Entity\View;
use Drupal\views\Plugin\views\field\Counter;
@ -125,15 +124,9 @@ class CounterTest extends UnitTestCase {
$expected = $i + 1;
$counter = $counter_handler->getValue($this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
}
/**
@ -157,15 +150,9 @@ class CounterTest extends UnitTestCase {
$expected = $rand_start + $i;
$counter = $counter_handler->getValue($this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
}
/**
@ -192,15 +179,9 @@ class CounterTest extends UnitTestCase {
$expected = $offset + $rand_start + $i;
$counter = $counter_handler->getValue($this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
}
/**
@ -231,15 +212,9 @@ class CounterTest extends UnitTestCase {
$expected = $items_per_page + $offset + $rand_start + $i;
$counter = $counter_handler->getValue($this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
'@expected' => $expected,
'@counter' => $counter
)));
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
}
/**

View file

@ -7,7 +7,6 @@
namespace Drupal\Tests\views\Unit;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Tests\UnitTestCase;
use Drupal\views\ViewsDataHelper;
use Drupal\views\Tests\ViewTestData;
@ -106,7 +105,7 @@ class ViewsDataHelperTest extends UnitTestCase {
array_walk($expected_keys, function(&$item) {
$item = "views_test_data.$item";
});
$this->assertEquals($expected_keys, array_keys($fields), SafeMarkup::format('Handlers of type @handler_type are not listed as expected.', array('@handler_type' => $handler_type)));
$this->assertEquals($expected_keys, array_keys($fields), "Handlers of type $handler_type are not listed as expected");
}
// Check for subtype filtering, so header and footer.
@ -117,7 +116,7 @@ class ViewsDataHelperTest extends UnitTestCase {
array_walk($expected_keys, function(&$item) {
$item = "views_test_data.$item";
});
$this->assertEquals($expected_keys, array_keys($fields), SafeMarkup::format('Sub_type @sub_type is not filtered as expected.', array('@sub_type' => $sub_type)));
$this->assertEquals($expected_keys, array_keys($fields), "Sub_type $sub_type is not filtered as expected.");
}
}