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
*/
public function addVersionCheckDownloadCounter()
{
$extension = new Extension();
$extension = $this->getAccessibleMock(
Extension::class,
['dummy']
);
$version = new Version();
$version->setDownloadCounter(12345);
$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(
12345,
$extension->getDownloads()
......@@ -310,10 +326,23 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
*/
public function addDownloads()
{
$extension = new Extension();
$extension = $this->getAccessibleMock(Extension::class, ['dummy']);
$extension->setDownloads(1000);
$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(
3000,
$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