diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-05-15 17:38:08 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-05-19 12:28:12 +0300 |
commit | 48fcb1d8b28d2fb73ea44499fccc082af7272a8e (patch) | |
tree | d66acd9d5d092f7c44c927c3231e7d87e264db3d /tests | |
parent | 84c804de6dfc5aa914572458b2976f0b268025fe (diff) |
Add kitinerary-sys adapter
This will allow using kitinerary-extractor when it's installed on the
system but invoking our binary and flatpak fail (due to platform
incompatibilities).
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Integration/KItinerary/ItineraryExtractorTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/Integration/KItinerary/ItineraryExtractorTest.php b/tests/Integration/KItinerary/ItineraryExtractorTest.php index 5849922eb..6a57959f1 100644 --- a/tests/Integration/KItinerary/ItineraryExtractorTest.php +++ b/tests/Integration/KItinerary/ItineraryExtractorTest.php @@ -27,6 +27,7 @@ namespace OCA\Mail\Tests\Unit\KItinerary; use ChristophWurst\KItinerary\Bin\BinaryAdapter; use ChristophWurst\KItinerary\Flatpak\FlatpakAdapter; +use ChristophWurst\KItinerary\Sys\SysAdapter; use ChristophWurst\Nextcloud\Testing\TestCase; use OCA\Mail\Integration\KItinerary\ItineraryExtractor; use OCP\ILogger; @@ -40,6 +41,9 @@ class ItineraryExtractorTest extends TestCase { /** @var FlatpakAdapter|MockObject */ private $flatpakAdapter; + /** @var SysAdapter|MockObject */ + private $sysAdapter; + /** @var ILogger|MockObject */ private $logger; @@ -51,11 +55,13 @@ class ItineraryExtractorTest extends TestCase { $this->binaryAdapter = $this->createMock(BinaryAdapter::class); $this->flatpakAdapter = $this->createMock(FlatpakAdapter::class); + $this->sysAdapter = $this->createMock(SysAdapter::class); $this->logger = $this->createMock(ILogger::class); $this->extractor = new ItineraryExtractor( $this->binaryAdapter, $this->flatpakAdapter, + $this->sysAdapter, $this->logger ); } @@ -101,4 +107,18 @@ class ItineraryExtractorTest extends TestCase { $this->assertEquals([], $itinerary->jsonSerialize()); } + + public function testSysAvailable() { + $this->binaryAdapter->expects($this->never()) + ->method('extractFromString'); + $this->sysAdapter->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); + $this->sysAdapter->expects($this->once()) + ->method('extractFromString'); + + $itinerary = $this->extractor->extract('data'); + + $this->assertEquals([], $itinerary->jsonSerialize()); + } } |