public function ServicesParserTests::testParser in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesParserTests.test \ServicesParserTests::testParser()
Testing parser functionality.
File
- tests/
functional/ ServicesParserTests.test, line 92 - Call the endpoint tests when no authentication is being used.
Class
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, t('Do not accept application/x-www-form-urlencoded if disabled.'), 'Parser');
}