GingerbreadTest.php in Bakery Single Sign-On System 8.2
File
tests/src/Unit/Cookies/GingerbreadTest.php
View source
<?php
namespace Drupal\Tests\bakery\Unit\Cookies;
use Drupal\bakery\Cookies\Gingerbread;
use Drupal\Tests\bakery\Traits\RemoteCookieTestTrait;
use Drupal\Tests\UnitTestCase;
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,
],
],
];
}
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());
}
}