Skip to content

Commit

Permalink
#27500 Migrate PHPUnit tests for MediaGallery module
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajsarowicz committed Apr 24, 2020
1 parent c7d6c2c commit efa81d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Magento\MediaGallery\Test\Unit\Model\Asset\Command;

use Laminas\Db\Adapter\Driver\Pdo\Statement;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Select;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

namespace Magento\MediaGallery\Test\Unit\Model\Asset\Command;

use Magento\MediaGallery\Model\Asset\Command\Save;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Adapter\Pdo\Mysql;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Reflection\DataObjectProcessor;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\Asset\Command\Save;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Magento\Framework\Reflection\DataObjectProcessor;
use Psr\Log\LoggerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function setUp(): void
/**
* Posive test for the main case
*
* @dataProvider casesProvider()
* @dataProvider casesProvider
* @param array $databaseQueryResult
* @param int $expectedNumberOfFoundKeywords
*/
Expand All @@ -81,8 +81,17 @@ public function casesProvider(): array
{
return [
'not_found' => [[],0],
'find_one_keyword' => [['keywordRawData'],1],
'find_several_keywords' => [['keywordRawData', 'keywordRawData'],2],
'find_one_keyword' => [
'result' => [['id' => 1, 'keyword' => 'keywordRawData']],
'expectedCount' => 1
],
'find_several_keywords' => [
'results' => [
['id' => 1, 'keyword'=> 'keywordRawData'],
['id' => 2, 'keyword' => 'keywordRawData']
],
'expectedCount' => 2
],
];
}

Expand Down

0 comments on commit efa81d7

Please sign in to comment.