Tests the Week handler.
\Drupal\node\Plugin\views\argument\CreatedWeek
public function testWeekHandler() {
$this->container
->get('database')
->update('views_test_data')
->fields(array(
'created' => gmmktime(0, 0, 0, 1, 1, 2000),
))
->condition('id', 3)
->execute();
$this->container
->get('database')
->update('views_test_data')
->fields(array(
'created' => gmmktime(0, 0, 0, 1, 10, 2000),
))
->condition('id', 4)
->execute();
$this->container
->get('database')
->update('views_test_data')
->fields(array(
'created' => gmmktime(0, 0, 0, 2, 1, 2000),
))
->condition('id', 5)
->execute();
$view = views_get_view('test_argument_date');
$view
->setDisplay('embed_3');
// The first jan 2000 was still in the last week of the previous year.
$this
->executeView($view, array(
52,
));
$expected = array();
$expected[] = array(
'id' => 1,
);
$expected[] = array(
'id' => 2,
);
$expected[] = array(
'id' => 3,
);
$this
->assertIdenticalResultset($view, $expected, $this->columnMap);
$view
->destroy();
$view
->setDisplay('embed_3');
$this
->executeView($view, array(
'02',
));
$expected = array();
$expected[] = array(
'id' => 4,
);
$this
->assertIdenticalResultset($view, $expected, $this->columnMap);
$view
->destroy();
$view
->setDisplay('embed_3');
$this
->executeView($view, array(
'05',
));
$expected = array();
$expected[] = array(
'id' => 5,
);
$this
->assertIdenticalResultset($view, $expected, $this->columnMap);
$view
->destroy();
$view
->setDisplay('embed_3');
$this
->executeView($view, array(
'23',
));
$expected = array();
$this
->assertIdenticalResultset($view, $expected, $this->columnMap);
}