ChocolateChipTest.php in Bakery Single Sign-On System 8.2
File
tests/src/Unit/Cookies/ChocolateChipTest.php
View source
<?php
namespace Drupal\Tests\bakery\Unit\Cookies;
use Drupal\bakery\Cookies\ChocolateChip;
use Drupal\Tests\bakery\Traits\CookieTestTrait;
use Drupal\Tests\UnitTestCase;
class ChocolateChipTest extends UnitTestCase {
use CookieTestTrait {
testFromData as traitFromDataTest;
testGetName as traitGetNameTest;
}
public function setUp() {
parent::setUp();
$this->cookie = ChocolateChip::class;
$this->cookieName = 'CHOCOLATECHIP';
$this->dataExtra = [
'calories' => 480,
];
$this
->setupBrowserContainer();
}
public function provideTestData() {
return [
'basic' => [
[
'name' => 'testuser1',
'mail' => 'asdfasdfasdfa',
'init' => 'foobar',
],
],
];
}
public function testFromData($data) {
$this->bakeryService
->isMain()
->willReturn(1, 0);
$this->bakeryService
->isChild()
->willReturn(0, 1);
$this->dataExtra['master'] = 1;
$this
->traitFromDataTest($data);
$this->dataExtra['master'] = 0;
$this
->traitFromDataTest($data);
}
}