mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
49 lines
1.2 KiB
PHP
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);
|
|
}
|
|
}
|