You are here

public function ServicesModuleTests::testServicesGetServers in Services 6.3

Verify services_get_servers() returs the REST server.

File

tests/unit/TestServicesModule.test, line 117
Unit tests for the functions in the 'services.module' file.

Class

ServicesModuleTests
Run test cases for the functions in the 'services.module' file.

Code

public function testServicesGetServers() {
  $results = services_get_servers();
  $message = t('\'services_get_servers\' should return an array.');
  $this
    ->assertTrue(gettype($results) == 'array', $message);
  $message = t('There should only be one element in the array.');
  $this
    ->assertEqual(count($results), 1, $message);
  $message = t('The key to the one element should be \'rest_server\'.');
  $this
    ->assertTrue(isset($results['rest_server']), $message);
  $message = t('Server name should be \'REST\'.');
  $this
    ->assertTrue(isset($results['rest_server']['name']) && $results['rest_server']['name'] == 'REST', $message);
  $message = t('Server path should be \'rest\'.');
  $this
    ->assertTrue(isset($results['rest_server']['path']) && $results['rest_server']['path'] == 'rest', $message);
}