You are here

public function KitchenTest::setUp in Bakery Single Sign-On System 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/KitchenTest.php, line 95

Class

KitchenTest
@coversDefaultClass \Drupal\bakery\Kitchen

Namespace

Drupal\Tests\bakery\Unit

Code

public function setUp() {
  parent::setUp();
  $this->request = new RequestStack();
  $this->request
    ->push(new Request());
  $this->time = new Time($this->request);
  $eventDispatcher = new EventDispatcher();
  $this->config = new Config('config.test', new MemoryStorage(), $eventDispatcher, $this
    ->prophesize(TypedConfigManagerInterface::class)
    ->reveal());
  $this->config
    ->set('bakery_key', 'test_key');
  $this->config
    ->set('bakery_cookie_extension', '_ext');
  $this->config
    ->set('bakery_domain', '.example.com');
  $this->config
    ->set('bakery_freshness', 3600);
  $this->currentUser = new AccountProxy($eventDispatcher);
  $this->cookieJar = new ParameterBag();
  $cf = $this
    ->prophesize(ConfigFactoryInterface::class);
  $cf
    ->get('bakery.settings')
    ->willReturn($this->config);
  $this->kitchen = new Kitchen($this->time, $cf
    ->reveal(), $this->currentUser, $this->cookieJar);
  $container = new Container();
  $container
    ->set('bakery.kitchen', $this->kitchen);
  \Drupal::setContainer($container);
}