public function HandlerTest::testPlaceholder in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/HandlerTest.php \Drupal\views\Tests\Handler\HandlerTest::testPlaceholder()
Tests the placeholder function.
See also
\Drupal\views\Plugin\views\HandlerBase::placeholder()
File
- core/
modules/ views/ src/ Tests/ Handler/ HandlerTest.php, line 310 - Contains \Drupal\views\Tests\Handler\HandlerTest.
Class
- HandlerTest
- Tests abstract handler definitions.
Namespace
Drupal\views\Tests\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);
}