You are here

class GingerbreadTest in Bakery Single Sign-On System 8.2

@coversDefaultClass \Drupal\bakery\Cookies\Gingerbread

Hierarchy

Expanded class hierarchy of GingerbreadTest

File

tests/src/Unit/Cookies/GingerbreadTest.php, line 12

Namespace

Drupal\Tests\bakery\Unit\Cookies
View source
class GingerbreadTest extends UnitTestCase {
  use RemoteCookieTestTrait;
  public function setUp() {
    parent::setUp();
    $this->cookie = Gingerbread::class;
    $this->cookieName = 'gingerbread';
    $this->remotePath = 'bakery/create';
  }
  public function provideTestData() {
    return [
      'basic' => [
        [
          'name' => 'testuser1',
          'or_email' => 1,
          'slave' => 'child.example.com',
          'uid' => 123,
        ],
      ],
      [
        [
          'name' => 'testuser1',
          'or_email' => 0,
          'slave' => 'child.example.com',
          'uid' => 123,
        ],
      ],
    ];
  }

  /**
   * @covers ::getAccountName
   * @covers ::getOrEmail
   * @covers ::getChild
   * @covers ::getChildUid
   * @dataProvider provideTestData
   */
  public function testAccessors($data) {
    $cookie = Gingerbread::fromData($data);
    $this
      ->assertEquals($data['name'], $cookie
      ->getAccountName());
    $this
      ->assertEquals($data['or_email'], $cookie
      ->getOrEmail());
    $this
      ->assertEquals($data['slave'], $cookie
      ->getChild());
    $this
      ->assertEquals($data['uid'], $cookie
      ->getChildUid());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CookieTestTrait::$bakeryService protected property
CookieTestTrait::$cookie protected property
CookieTestTrait::$cookieName protected property
CookieTestTrait::$dataExtra protected property
CookieTestTrait::$kitchenService protected property
CookieTestTrait::setupBrowserContainer protected function
CookieTestTrait::testFromData public function @covers ::__construct @covers ::toData @covers ::fromData @dataProvider provideTestData
CookieTestTrait::testGetName public function @covers ::getName
GingerbreadTest::provideTestData public function Overrides CookieTestTrait::provideTestData
GingerbreadTest::setUp public function Overrides UnitTestCase::setUp
GingerbreadTest::testAccessors public function @covers ::getAccountName @covers ::getOrEmail @covers ::getChild @covers ::getChildUid @dataProvider provideTestData
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
RemoteCookieTestTrait::$remotePath protected property
RemoteCookieTestTrait::testGetPath public function @covers ::getPath @dataProvider provideTestData
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.