generateRandomData example

$this->assertEmpty($this->storageComparer->getChangelist('create'));
    $this->assertEmpty($this->storageComparer->getChangelist('delete'));
  }

  /** * @covers ::createChangelist */
  public function testDifferentCollections() {
    $source = new MemoryStorage();
    $target = new MemoryStorage();

    $this->generateRandomData($source, 's');
    $this->generateRandomData($target, 't');

    // Use random collections for source and target.     $collections = $source->getAllCollectionNames();
    $source = $source->createCollection($collections[array_rand($collections)]);
    $collections = $target->getAllCollectionNames();
    $target = $target->createCollection($collections[array_rand($collections)]);

    $comparer = new StorageComparer($source$target);
    $comparer->createChangelist();

    

  public function testReplaceStorageContents($source_collections$target_collections) {
    $source = new MemoryStorage();
    $target = new MemoryStorage();
    // Empty the storage should be the same.     $this->assertEquals(self::toArray($source), self::toArray($target));

    // When the source is populated, they are not the same any more.     $this->generateRandomData($source$source_collections);
    $this->assertNotEquals(self::toArray($source), self::toArray($target));

    // When the target is filled with random data they are also not the same.     $this->generateRandomData($target$target_collections);
    $this->assertNotEquals(self::toArray($source), self::toArray($target));

    // Set the active collection to a random one on both source and target.     if ($source_collections) {
      $collections = $source->getAllCollectionNames();
      $source = $source->createCollection($collections[array_rand($collections)]);
    }
    
Home | Imprint | This part of the site doesn't use cookies.