tempCsvFile = tempnam(sys_get_temp_dir(), 'shlink_csv'); if (! $this->tempCsvFile) { return; } $handle = fopen($this->tempCsvFile, 'w+'); if (! $handle) { $this->fail('It was not possible to open the temporary file to write CSV on it'); } fwrite( $handle, <<tempCsvFile)) { unlink($this->tempCsvFile); } } #[Test] public function defaultDomainIsIgnoredWhenExplicitlyProvided(): void { if (! $this->tempCsvFile) { $this->fail('It was not possible to create a temporary CSV file'); } [$output] = $this->exec([ImportCommand::NAME, 'csv'], [$this->tempCsvFile, ';']); self::assertStringContainsString('https://shlink.io: Imported', $output); self::assertStringContainsString('https://example.com: Imported', $output); [$listOutput1] = $this->exec( [ListShortUrlsCommand::NAME, '--show-domain', '--search-term', 'testing-default-domain-import-1'], ); self::assertStringContainsString('DEFAULT', $listOutput1); [$listOutput1] = $this->exec( [ListShortUrlsCommand::NAME, '--show-domain', '--search-term', 'testing-default-domain-import-2'], ); self::assertStringContainsString('DEFAULT', $listOutput1); } }