class StroopwafelTest in Bakery Single Sign-On System 8.2
@coversDefaultClass \Drupal\bakery\Cookies\Stroopwafel
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\bakery\Unit\Cookies\StroopwafelTest uses RemoteCookieTestTrait
Expanded class hierarchy of StroopwafelTest
File
- tests/
src/ Unit/ Cookies/ StroopwafelTest.php, line 14
Namespace
Drupal\Tests\bakery\Unit\CookiesView source
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());
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | function | ||
CookieTestTrait:: |
public | function | @covers ::__construct @covers ::toData @covers ::fromData @dataProvider provideTestData | |
CookieTestTrait:: |
public | function | @covers ::getName | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RemoteCookieTestTrait:: |
protected | property | ||
RemoteCookieTestTrait:: |
public | function | @covers ::getPath @dataProvider provideTestData | |
StroopwafelTest:: |
public | function |
Overrides CookieTestTrait:: |
|
StroopwafelTest:: |
public | function |
Overrides UnitTestCase:: |
|
StroopwafelTest:: |
public | function | @covers ::getUid @covers ::getData @dataProvider provideTestData | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |