FieldDropButtonTest.php in Zircon Profile 8.0
File
core/modules/views/src/Tests/Handler/FieldDropButtonTest.php
View source
<?php
namespace Drupal\views\Tests\Handler;
class FieldDropButtonTest extends HandlerTestBase {
public static $testViews = array(
'test_dropbutton',
);
public static $modules = array(
'node',
);
public function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser([
'access content overview',
'administer nodes',
'bypass node access',
]);
$this
->drupalLogin($admin_user);
}
public function testDropbutton() {
$nodes = array();
for ($i = 0; $i < 5; $i++) {
$nodes[] = $this
->drupalCreateNode();
}
$this
->drupalGet('test-dropbutton');
foreach ($nodes as $node) {
$result = $this
->xpath('//ul[contains(@class, dropbutton)]/li/a[contains(@href, :path) and text()=:title]', array(
':path' => '/node/' . $node
->id(),
':title' => $node
->label(),
));
$this
->assertEqual(count($result), 1, 'Just one node title link was found.');
$result = $this
->xpath('//ul[contains(@class, dropbutton)]/li/a[contains(@href, :path) and text()=:title]', array(
':path' => '/node/' . $node
->id(),
':title' => t('Custom Text'),
));
$this
->assertEqual(count($result), 1, 'Just one custom link was found.');
}
$this
->drupalGet('admin/content');
$this
->assertRaw('dropbutton.js');
$this
->drupalGet('admin/content');
$this
->assertRaw('dropbutton.js');
}
}