Commit ef3893d7 authored by Thomas Löffler's avatar Thomas Löffler

Fix unit tests with downloadRepository

parent 73e1cb51
Pipeline #10070 failed with stages
in 3 minutes and 42 seconds
...@@ -233,11 +233,27 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase ...@@ -233,11 +233,27 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
*/ */
public function addVersionCheckDownloadCounter() public function addVersionCheckDownloadCounter()
{ {
$extension = new Extension(); $extension = $this->getAccessibleMock(
Extension::class,
['dummy']
);
$version = new Version(); $version = new Version();
$version->setDownloadCounter(12345); $version->setDownloadCounter(12345);
$extension->addVersion($version); $extension->addVersion($version);
$downloadRepository = $this->getAccessibleMock(
\T3o\TerFe2\Domain\Repository\DownloadRepository::class,
['findDownloadsByExtensionkey'],
[],
'',
false
);
$extension->_set('downloadRepository', $downloadRepository);
$downloadRepository->expects(self::once())
->method('findDownloadsByExtensionkey')
->with($extension->getExtKey())
->willReturn(0);
self::assertEquals( self::assertEquals(
12345, 12345,
$extension->getDownloads() $extension->getDownloads()
...@@ -310,10 +326,23 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase ...@@ -310,10 +326,23 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
*/ */
public function addDownloads() public function addDownloads()
{ {
$extension = new Extension(); $extension = $this->getAccessibleMock(Extension::class, ['dummy']);
$extension->setDownloads(1000); $extension->setDownloads(1000);
$extension->addDownloads(2000); $extension->addDownloads(2000);
$downloadRepository = $this->getAccessibleMock(
\T3o\TerFe2\Domain\Repository\DownloadRepository::class,
['findDownloadsByExtensionkey'],
[],
'',
false
);
$extension->_set('downloadRepository', $downloadRepository);
$downloadRepository->expects(self::once())
->method('findDownloadsByExtensionkey')
->with($extension->getExtKey())
->willReturn(0);
self::assertEquals( self::assertEquals(
3000, 3000,
$extension->getDownloads() $extension->getDownloads()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment