You are here

public function CasPropertyBagTest::testSetUsername in CAS 2.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/CasPropertyBagTest.php \Drupal\Tests\cas\Unit\CasPropertyBagTest::testSetUsername()

Test setting a username.

@covers ::setUsername

File

tests/src/Unit/CasPropertyBagTest.php, line 35

Class

CasPropertyBagTest
CasPropertyBag unit tests.

Namespace

Drupal\Tests\cas\Unit

Code

public function testSetUsername() {
  $name = $this
    ->randomMachineName(8);
  $bag = new CasPropertyBag($name);
  $new_name = $this
    ->randomMachineName(8);
  $bag
    ->setUsername($new_name);
  $this
    ->assertEquals($new_name, $bag
    ->getUsername());
  $this
    ->assertEquals($name, $bag
    ->getOriginalUsername());
}