trait CookieTestTrait in Bakery Single Sign-On System 8.2
Hierarchy
- trait \Drupal\Tests\bakery\Traits\CookieTestTrait
3 files declare their use of CookieTestTrait
- ChocolateChipTest.php in tests/
src/ Unit/ Cookies/ ChocolateChipTest.php - GingerbreadReturnTest.php in tests/
src/ Unit/ Cookies/ GingerbreadReturnTest.php - OatmealCookieTest.php in tests/
src/ Unit/ Cookies/ OatmealCookieTest.php
File
- tests/
src/ Traits/ CookieTestTrait.php, line 11
Namespace
Drupal\Tests\bakery\TraitsView source
trait CookieTestTrait {
/**
* @var string
*/
protected $cookie;
/**
* @var string
*/
protected $cookieName;
protected $dataExtra = [];
/**
* @var \Drupal\bakery\Kitchen|\Prophecy\Prophecy\ObjectProphecy
*/
protected $kitchenService;
/**
* @var \Drupal\bakery\BakeryService|\Prophecy\Prophecy\ObjectProphecy
*/
protected $bakeryService;
/**
* @covers ::__construct
* @covers ::toData
* @covers ::fromData
* @dataProvider provideTestData
*/
public function testFromData($data) {
$this
->assertEquals($data + $this->dataExtra, $this->cookie::fromData($data)
->toData());
}
public abstract function provideTestData();
/**
* @covers ::getName
*/
public function testGetName() {
$this
->assertEquals($this->cookieName, $this->cookie::getName());
}
protected function setupBrowserContainer() {
$container = new Container();
$this->kitchenService = $this
->prophesize(Kitchen::class);
$this->bakeryService = $this
->prophesize(BakeryService::class);
$this->kitchenService
->cookieName(Argument::any())
->willReturn($this->cookieName);
$container
->set('bakery.kitchen', $this->kitchenService
->reveal());
$container
->set('bakery.bakery_service', $this->bakeryService
->reveal());
\Drupal::setContainer($container);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
protected | property | ||
CookieTestTrait:: |
abstract public | function | 5 | |
CookieTestTrait:: |
protected | function | ||
CookieTestTrait:: |
public | function | @covers ::__construct @covers ::toData @covers ::fromData @dataProvider provideTestData | |
CookieTestTrait:: |
public | function | @covers ::getName |