function ServicesUITest::testEndpointMachineName in Services 7.3
Same name and namespace in other branches
- 6.3 tests/ui/ServicesUITests.test \ServicesUITest::testEndpointMachineName()
File
- tests/
ui/ ServicesUITests.test, line 32 - Tests for UI of Services.
Class
- ServicesUITest
- @file Tests for UI of Services.
Code
function testEndpointMachineName() {
// Try to create endpoint with bad machine name.
$edit = array(
'name' => 're st',
'server' => 'rest_server',
'path' => 'rest',
);
$this
->drupalPost('admin/structure/services/add', $edit, 'Save');
$this
->assertText('The endpoint name can only consist of lowercase letters, underscores, and numbers.', 'It is not possible to create endpoint with bad machine name.');
// Create endpoint properly.
$edit = array(
'name' => 'rest',
'server' => 'rest_server',
'path' => 'rest',
);
$this
->drupalPost('admin/structure/services/add', $edit, 'Save');
$this
->assertText('rest', 'Endpoint create successfully.');
// Try to create endpoint with same machine name.
$edit = array(
'name' => 'rest',
'server' => 'rest_server',
'path' => 'rest1',
);
$this
->drupalPost('admin/structure/services/add', $edit, 'Save');
$this
->assertText('The machine-readable name is already in use. It must be unique.', 'It is not possible to create endpoint with existing machine name.');
// Try to create endpoint with same path.
$edit = array(
'name' => 'rest1',
'server' => 'rest_server',
'path' => 'rest',
);
$this
->drupalPost('admin/structure/services/add', $edit, 'Save');
$this
->assertText('Endpoint path must be unique.', 'It is not possible to create endpoint with existing path.');
}