public function RestWSTestCase::testMenuPath in RESTful Web Services 7.2
Test menu path resource setting.
File
- ./
restws.test, line 533 - RESTful web services tests.
Class
- RestWSTestCase
- @file RESTful web services tests.
Code
public function testMenuPath() {
$account = $this
->drupalCreateUser(array(
'access content',
'bypass node access',
'access resource node',
));
$this
->drupalLogin($account);
$title = $this
->randomName(8);
$node = $this
->drupalCreateNode(array(
'title' => $title,
));
module_enable(array(
'restws_test',
), TRUE);
foreach (array(
'bar',
'foo/bar',
'foo/bar/node',
'api-v1.2',
'this/is/a/really/long/path',
) as $menu_path) {
// Register the menu_path for this test.
variable_set('restws_test_menu_path', $menu_path);
variable_set('menu_rebuild_needed', TRUE);
// Verify that the query uri is working.
$result = $this
->drupalGet($menu_path . '.json');
$this
->assertResponse(200);
$result = drupal_json_decode($result);
$this
->assertEqual($result['list'][0]['title'], $title);
// Verify that the view uri is working.
$result = $this
->drupalGet($menu_path . '/1.json');
$this
->assertResponse(200);
$result = drupal_json_decode($result);
$this
->assertEqual($result['title'], $title);
}
}