HandlerArgumentUserUidTest.php in Zircon Profile 8
File
core/modules/user/src/Tests/Views/HandlerArgumentUserUidTest.php
View source
<?php
namespace Drupal\user\Tests\Views;
use Drupal\views\Views;
class HandlerArgumentUserUidTest extends UserTestBase {
public static $testViews = array(
'test_user_uid_argument',
);
public function testArgumentTitle() {
$view = Views::getView('test_user_uid_argument');
$this
->executeView($view, array(
rand(1000, 10000),
));
$this
->assertFalse($view
->getTitle());
$view
->destroy();
$account = $this
->drupalCreateUser();
$this
->executeView($view, array(
$account
->id(),
));
$this
->assertEqual($view
->getTitle(), $account
->label());
$view
->destroy();
$anonymous = $this
->config('user.settings')
->get('anonymous');
$this
->executeView($view, array(
0,
));
$this
->assertEqual($view
->getTitle(), $anonymous);
$view
->destroy();
$view
->getDisplay()
->getHandler('argument', 'uid')->options['break_phrase'] = TRUE;
$this
->executeView($view, array(
$account
->id() . ',0',
));
$this
->assertEqual($view
->getTitle(), $account
->label() . ', ' . $anonymous);
$view
->destroy();
$view
->getDisplay()
->getHandler('argument', 'uid')->options['break_phrase'] = TRUE;
$this
->executeView($view, array(
'0,' . $account
->id(),
));
$this
->assertEqual($view
->getTitle(), $anonymous . ', ' . $account
->label());
$view
->destroy();
}
}