public function testFileComposta() { $dir_temp = __DIR__ . '/../../src/Database/Migration/Templates'; $dir_target = __DIR__ . '/Ola'; $t = new \Bugotech\IO\Template(); try { $t->make($dir_temp, $dir_target); //Verificar se o Diretório foi criado $this->assertFileExists($dir_target); //Pegar conteúdo do dir_temp $files_dir = []; $arquivos_dir = $this->file->allFiles($dir_temp); foreach ($arquivos_dir as $item) { $i = new stdClass(); $i->nome = $item->getPathname(); $i->valor = $item->getContents(); $i->trocado = str_replace('{{class}}', 'OlaMundo', str_replace('{{table}}', 'Tabela', $i->valor)); $files_dir[] = $i; } //Pegar conteúdo do dir_target $files_target = []; $arquivos_target = $this->file->allFiles($dir_target); foreach ($arquivos_target as $item) { $i = new stdClass(); $i->nome = $item->getPathname(); $i->valor = $item->getContents(); $files_target[] = $i; } //Comparando os dois valores $ret = $this->compararArrays($files_dir, $files_target); $this->assertTrue($ret); /*Param não funcionando para mais de um File //Atribuindo o Param $t->param('class', 'OlaMundo'); $t->param('table', 'Tabela'); //Pegar conteúdo do dir_target $files_target = []; $arquivos_target = $this->file->allFiles($dir_target); foreach ($arquivos_target as $item) { $i = new stdClass(); $i->nome = $item->getPathname(); $i->valor = $item->getContents(); $i->trocado = $item->getContents(); $files_target[] = $i; } $ret = $this->compararArrays($files_dir, $files_target, 'trocado'); $this->assertTrue($ret);*/ $this->file->deleteDirectory($dir_target, false); } catch (Exception $e) { $this->file->deleteDirectory($dir_target, false); print_r($e->getMessage()); } }