You are here

public function CasServerConfigTest::testGetters in CAS 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/CasServerConfigTest.php \Drupal\Tests\cas\Unit\CasServerConfigTest::testGetters()

Test getters.

File

tests/src/Unit/CasServerConfigTest.php, line 21

Class

CasServerConfigTest
CasServerConfig unit tests.

Namespace

Drupal\Tests\cas\Unit

Code

public function testGetters() {
  $configFactory = $this
    ->getConfigFactoryStub([
    'cas.settings' => [
      'server.hostname' => 'example.com',
      'server.protocol' => 'https',
      'server.port' => 443,
      'server.path' => '/cas',
      'server.version' => '1.0',
      'server.verify' => CasHelper::CA_DEFAULT,
      'server.cert' => 'foo',
      'advanced.connection_timeout' => 30,
    ],
  ]);
  $serverConfig = CasServerConfig::createFromModuleConfig($configFactory
    ->get('cas.settings'));
  $this
    ->assertEquals('example.com', $serverConfig
    ->getHostname());
  $this
    ->assertEquals('https', $serverConfig
    ->getHttpScheme());
  $this
    ->assertEquals(443, $serverConfig
    ->getPort());
  $this
    ->assertEquals('/cas', $serverConfig
    ->getPath());
  $this
    ->assertEquals('1.0', $serverConfig
    ->getProtocolVerison());
  $this
    ->assertEquals('foo', $serverConfig
    ->getCustomRootCertBundlePath());
  $this
    ->assertEquals(CasHelper::CA_DEFAULT, $serverConfig
    ->getVerify());
  $this
    ->assertEquals(30, $serverConfig
    ->getDirectConnectionTimeout());
}