SharedTempStoreFactory example

public function testSharedTempStore() {
    // Create testing objects.     $objects = [];
    for ($i = 0; $i <= 3; $i++) {
      $objects[$i] = $this->randomObject();
    }

    // Create a key/value collection.     $database = Database::getConnection();
    // Mock the current user service so that isAnonymous returns FALSE.     $current_user = $this->prophesize(AccountProxyInterface::class);
    $factory = new SharedTempStoreFactory(
      new KeyValueExpirableFactory(\Drupal::getContainer()),
      new DatabaseLockBackend($database),
      $this->container->get('request_stack'),
      $current_user->reveal()
    );
    $collection = $this->randomMachineName();

    // Create two mock users.     for ($i = 0; $i <= 1; $i++) {
      $users[$i] = mt_rand(500, 5000000);

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