StroopwafelTest.php in Bakery Single Sign-On System 8.2
Namespace
Drupal\Tests\bakery\Unit\CookiesFile
tests/src/Unit/Cookies/StroopwafelTest.phpView source
<?php
namespace Drupal\Tests\bakery\Unit\Cookies;
use Drupal\bakery\Cookies\Gingerbread;
use Drupal\bakery\Cookies\Stroopwafel;
use Drupal\Tests\bakery\Traits\RemoteCookieTestTrait;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\bakery\Cookies\Stroopwafel
*/
class StroopwafelTest extends UnitTestCase {
use RemoteCookieTestTrait;
public function setUp() {
parent::setUp();
$this->cookie = Stroopwafel::class;
$this->cookieName = 'stroopwafel';
$this->remotePath = 'bakery/update';
// Legacy category property.
$this->dataExtra = [
'category' => 'account',
];
}
public function provideTestData() {
return [
'basic' => [
[
'uid' => 123,
'data' => serialize([
'name' => 'testuser',
]),
],
],
];
}
/**
* @covers ::getUid
* @covers ::getData
* @dataProvider provideTestData
*/
public function testAccessors($data) {
$cookie = Stroopwafel::fromData($data);
$this
->assertEquals($data['uid'], $cookie
->getUid());
$this
->assertEquals(unserialize($data['data']), $cookie
->getData());
}
}
Classes
Name | Description |
---|---|
StroopwafelTest | @coversDefaultClass \Drupal\bakery\Cookies\Stroopwafel |