mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Add disableContentUpdate import option
This commit also decouples the "import" and "update" functions inside ContentProxy. If a content array is available, it must be passed to the new importEntry method.
This commit is contained in:
parent
1c5da417e4
commit
d0e9b3d640
11 changed files with 118 additions and 60 deletions
|
@ -89,7 +89,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(1))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$res = $chromeImport->import();
|
||||
|
@ -118,7 +118,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(1))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -158,7 +158,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -198,7 +198,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
|
|
@ -89,7 +89,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(2))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$res = $firefoxImport->import();
|
||||
|
@ -118,7 +118,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(1))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -158,7 +158,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -198,7 +198,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
|
|
@ -104,7 +104,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(4))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$res = $instapaperImport->import();
|
||||
|
@ -133,7 +133,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->once())
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -173,7 +173,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -213,7 +213,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
|
|
@ -282,7 +282,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->once())
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$pocketImport->setClient($client);
|
||||
|
@ -377,7 +377,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(2))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$pocketImport->setClient($client);
|
||||
|
@ -450,7 +450,7 @@ JSON;
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -536,7 +536,7 @@ JSON;
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('ImportEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
@ -621,7 +621,7 @@ JSON;
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->once())
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->will($this->throwException(new \Exception()));
|
||||
|
||||
$pocketImport->setClient($client);
|
||||
|
|
|
@ -89,7 +89,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(3))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$res = $readabilityImport->import();
|
||||
|
@ -118,7 +118,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(1))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -158,7 +158,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -198,7 +198,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
|
|
@ -104,7 +104,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(1))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn($entry);
|
||||
|
||||
$res = $wallabagV1Import->import();
|
||||
|
@ -133,7 +133,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(3))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -173,7 +173,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -213,7 +213,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
|
|
@ -100,7 +100,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(2))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
$res = $wallabagV2Import->import();
|
||||
|
@ -129,7 +129,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(2))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->willReturn(new Entry($this->user));
|
||||
|
||||
// check that every entry persisted are archived
|
||||
|
@ -165,7 +165,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -201,7 +201,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
->method('importEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
|
@ -278,7 +278,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->contentProxy
|
||||
->expects($this->exactly(2))
|
||||
->method('updateEntry')
|
||||
->method('importEntry')
|
||||
->will($this->throwException(new \Exception()));
|
||||
|
||||
$res = $wallabagV2Import->import();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue