public function HandlerTest::testPlaceholder in Views (for Drupal 7) 8.3
Tests the placeholder function.
See also
Drupal\views\Plugin\views\HandlerBase::placeholder()
File
- lib/
Drupal/ views/ Tests/ Handler/ HandlerTest.php, line 303 - Definition of Drupal\views\Tests\Handler\HandlerTest.
Class
- HandlerTest
- Tests abstract handlers of views.
Namespace
Drupal\views\Tests\HandlerCode
public function testPlaceholder() {
$view = $this
->getView();
$view
->initHandlers();
$view
->initQuery();
$handler = $view->field['name'];
$table = $handler->table;
$field = $handler->field;
$string = ':' . $table . '_' . $field;
// Make sure the placeholder variables are like expected.
$this
->assertEqual($handler
->getPlaceholder(), $string);
$this
->assertEqual($handler
->getPlaceholder(), $string . 1);
$this
->assertEqual($handler
->getPlaceholder(), $string . 2);
// Set another table/field combination and make sure there are new
// placeholders.
$table = $handler->table = $this
->randomName();
$field = $handler->field = $this
->randomName();
$string = ':' . $table . '_' . $field;
// Make sure the placeholder variables are like expected.
$this
->assertEqual($handler
->getPlaceholder(), $string);
$this
->assertEqual($handler
->getPlaceholder(), $string . 1);
$this
->assertEqual($handler
->getPlaceholder(), $string . 2);
}