public function HandlerTest::testPlaceholder in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::testPlaceholder()
- 10 core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::testPlaceholder()
Tests the placeholder function.
See also
\Drupal\views\Plugin\views\HandlerBase::placeholder()
File
- core/
modules/ views/ tests/ src/ Functional/ Handler/ HandlerTest.php, line 340
Class
- HandlerTest
- Tests abstract handler definitions.
Namespace
Drupal\Tests\views\Functional\HandlerCode
public function testPlaceholder() {
$view = Views::getView('test_view');
$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
->randomMachineName();
$field = $handler->field = $this
->randomMachineName();
$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);
}