public function ServicesParserTests::testParser in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesParserTests.test \ServicesParserTests::testParser()
Testing parser functionality.
File
- tests/
functional/ ServicesParserTests.test, line 86 - Call the endpoint tests when no authentication is being used.
Class
- ServicesParserTests
- Run test cases for the endpoint with no authentication turned on.
Code
public function testParser() {
$account = $this
->drupalCreateUser();
// Logout first.
$this
->drupalLogout();
// Try to login. By default servicesPost uses
// 'application/x-www-form-urlencoded' type. So it should be refused.
$response = $this
->servicesPost($this->endpoint->path . '/user/login', array(
'username' => $account->name,
'password' => $account->pass_raw,
));
$this
->assertTrue(strpos($response['header'], '406 Not Acceptable : Unsupported request content type application/x-www-form-urlencoded') !== FALSE, 'Do not accept application/x-www-form-urlencoded if disabled.', 'Parser');
}