You are here

function ServicesArgumentsTestCase::testPathArguments in Services 7.3

Test two path arguments of

File

tests/functional/ServicesArgumentsTests.test, line 38

Class

ServicesArgumentsTestCase

Code

function testPathArguments() {
  $arg1 = $this
    ->randomName();
  $arg2 = $this
    ->randomName();
  $arg3 = $this
    ->randomName();
  $result = $this
    ->servicesGet($this->endpoint->path . '/services_arguments_test/' . $arg1 . '/' . $arg2 . '/' . $arg3);
  $this
    ->assertEqual($result['body'], format_string('Services arguments test @arg1 @arg2 @arg3', array(
    '@arg1' => $arg1,
    '@arg2' => $arg2,
    '@arg3' => $arg3,
  )), 'Path arguments work properly.', 'Arguments');
  $result = $this
    ->servicesGet($this->endpoint->path . '/services_arguments_test/' . $arg1 . '/' . $arg2);
  $this
    ->assertEqual($result['body'], format_string('Services arguments test @arg1 @arg2 0', array(
    '@arg1' => $arg1,
    '@arg2' => $arg2,
  )), 'Path arguments with default value work properly.', 'Arguments');
  $result = $this
    ->servicesGet($this->endpoint->path . '/services_arguments_test/' . $arg1);
  $this
    ->assertEqual($result['status'], 'HTTP/1.1 404 Not found : Could not find the controller.', 'Error triggered when required argument is missing.', 'Arguments');
}