You are here

public function OatmealCookieTest::testFromData in Bakery Single Sign-On System 8.2

@covers ::__construct @covers ::toData @covers ::fromData @dataProvider provideTestData

File

tests/src/Unit/Cookies/OatmealCookieTest.php, line 40

Class

OatmealCookieTest
@coversDefaultClass \Drupal\bakery\Cookies\OatmealCookie

Namespace

Drupal\Tests\bakery\Unit\Cookies

Code

public function testFromData($data) {

  // Mock reasonable function calls based on if cookie is from main site or child.
  if ($data['master']) {
    $this->bakeryService
      ->isMain()
      ->willReturn(1);
    $this->bakeryService
      ->isChild()
      ->willReturn(0);
  }
  else {
    $this->bakeryService
      ->isMain()
      ->willReturn(0);
    $this->bakeryService
      ->isChild()
      ->willReturn(1);

    // If on child, the slave property needs to be populated.
    $this->dataExtra += [
      'slave' => '/',
    ];
  }
  $this
    ->traitFromDataTest($data);
}