PrivateKey example

protected $key;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->key = Crypt::randomBytesBase64(55);

    $this->state = $this->createMock('Drupal\Core\State\StateInterface');

    $this->privateKey = new PrivateKey($this->state);
  }

  /** * Tests PrivateKey::get(). */
  public function testGet() {
    $this->state->expects($this->once())
      ->method('get')
      ->with('system.private_key')
      ->willReturn($this->key);

    
Home | Imprint | This part of the site doesn't use cookies.