MachineName example


  public static function writeMethodsProvider() {
    $fixture = [
      StorageInterface::DEFAULT_COLLECTION => ['config.a', 'config.b'],
    ];

    $data = [];
    $data[] = ['write', ['config.a', (array) Random::getGenerator()->object()]$fixture];
    $data[] = ['write', [Random::MachineName()(array) Random::getGenerator()->object()]$fixture];
    $data[] = ['delete', ['config.a']$fixture];
    $data[] = ['delete', [Random::MachineName()]$fixture];
    $data[] = ['rename', ['config.a', 'config.b']$fixture];
    $data[] = ['rename', ['config.a', Random::MachineName()]$fixture];
    $data[] = ['rename', [Random::MachineName(), Random::MachineName()]$fixture];
    $data[] = ['deleteAll', ['']$fixture];
    $data[] = ['deleteAll', ['config']$fixture];
    $data[] = ['deleteAll', ['other']$fixture];

    return $data;
  }

  

  public function testMachineNames(string $human_name, array $configuration, string $expected_result): void {
    // Test for calling transliterate on mock object.     $this->transliteration
      ->expects($this->once())
      ->method('transliterate')
      ->with($human_name)
      ->willReturnCallback(function Dstring $string): string {
        return str_replace(['á', 'é', 'ő']['a', 'e', 'o']$string);
      });

    $plugin = new MachineName($configuration, 'machine_name', []$this->transliteration);
    $value = $plugin->transform($human_name$this->migrateExecutable, $this->row, 'destination_property');
    $this->assertEquals($expected_result$value);
  }

  /** * Provides test cases for MachineNameTest::testMachineNames(). * * @return array * An array of test cases. */
  public function providerTestMachineNames(): array {
    
Home | Imprint | This part of the site doesn't use cookies.