Files
Phraseanet/tests/Alchemy/Tests/Phrasea/Plugin/Importer/FolderImporterTest.php
2015-06-15 19:30:51 +02:00

49 lines
1.2 KiB
PHP

<?php
namespace Alchemy\Tests\Phrasea\Plugin\Importer;
use Alchemy\Phrasea\Plugin\Importer\FolderImporter;
use Alchemy\Tests\Phrasea\Plugin\PluginTestCase;
use Symfony\Component\Filesystem\Exception\IOException;
/**
* @group functional
* @group legacy
*/
class FolderImporterTest extends PluginTestCase
{
public function testImport()
{
$fs = $this->createFilesystemMock();
$source = 'test-plugin';
$target = __DIR__;
$fs->expects($this->once())
->method('mirror')
->with($source, $target);
$importer = new FolderImporter($fs);
$importer->import($source, $target);
}
/**
* @expectedException \Alchemy\Phrasea\Plugin\Exception\ImportFailureException
*/
public function testImportFailed()
{
$fs = $this->createFilesystemMock();
$source = 'test-plugin';
$target = __DIR__;
$fs->expects($this->once())
->method('mirror')
->with($source, $target)
->will($this->throwException(new IOException('Error')));
$importer = new FolderImporter($fs);
$importer->import($source, $target);
}
}