class GingerbreadTest in Bakery Single Sign-On System 8.2
@coversDefaultClass \Drupal\bakery\Cookies\Gingerbread
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\bakery\Unit\Cookies\GingerbreadTest uses RemoteCookieTestTrait
Expanded class hierarchy of GingerbreadTest
File
- tests/
src/ Unit/ Cookies/ GingerbreadTest.php, line 12
Namespace
Drupal\Tests\bakery\Unit\CookiesView 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
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 | |
GingerbreadTest:: |
public | function |
Overrides CookieTestTrait:: |
|
GingerbreadTest:: |
public | function |
Overrides UnitTestCase:: |
|
GingerbreadTest:: |
public | function | @covers ::getAccountName @covers ::getOrEmail @covers ::getChild @covers ::getChildUid @dataProvider provideTestData | |
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 | |
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. |