Skip to content

Commit 0a988d3

Browse files
committed
MAGETWO-38296: [Add join processors to search service] UI Module
- Fixed Bookmark model with correct resource - Refactored getList test to return results
1 parent 7793933 commit 0a988d3

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

app/code/Magento/Ui/Model/Bookmark.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ public function __construct(
6161
);
6262
}
6363

64+
/**
65+
* Initialize bookmark model
66+
*
67+
* @return void
68+
*/
69+
public function _construct()
70+
{
71+
$this->_init('Magento\Ui\Model\Resource\Bookmark');
72+
}
73+
6474
/**
6575
* Get Id
6676
*

dev/tests/integration/testsuite/Magento/Ui/Model/Resource/BookmarkRepositoryTest.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,48 @@
77
namespace Magento\Ui\Model\Resource;
88

99
use Magento\TestFramework\Helper\Bootstrap;
10+
use Magento\Ui\Api\BookmarkRepositoryInterface;
11+
use Magento\Ui\Api\Data\BookmarkInterface;
1012

1113
class BookmarkRepositoryTest extends \PHPUnit_Framework_TestCase
1214
{
1315
/**
14-
* @var BookmarkRepository
16+
* @var BookmarkRepositoryInterface
1517
*/
1618
protected $bookmarkRepository;
1719

20+
/**
21+
* @var \Magento\Ui\Model\BookmarkFactory
22+
*/
23+
protected $bookmarkFactory;
24+
25+
/**
26+
* @var BookmarkInterface
27+
*/
28+
protected $bookmark;
29+
30+
/**
31+
* @magentoDataFixture Magento/Customer/_files/customer.php
32+
*/
1833
protected function setUp()
1934
{
2035
$this->bookmarkRepository = Bootstrap::getObjectManager()
2136
->create('Magento\Ui\Model\Resource\BookmarkRepository');
37+
$this->bookmarkFactory = Bootstrap::getObjectManager()->create('Magento\Ui\Model\BookmarkFactory');
38+
$this->bookmark = $this->bookmarkFactory->create()->setUserId(1)->setTitle('test');
39+
$this->bookmark = $this->bookmarkRepository->save($this->bookmark);
40+
}
41+
42+
protected function tearDown()
43+
{
44+
$this->bookmarkRepository->delete($this->bookmark);
2245
}
2346

24-
public function testGetListEmpty()
47+
public function testGetList()
2548
{
2649
/** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */
2750
$searchBuilder = Bootstrap::getObjectManager()->create('Magento\Framework\Api\SearchCriteriaBuilder');
28-
$searchResults = $this->bookmarkRepository->getList($searchBuilder->create());
29-
$this->assertEquals(0, $searchResults->getTotalCount());
51+
$searchResult = $this->bookmarkRepository->getList($searchBuilder->create());
52+
$this->assertTrue($searchResult->getTotalCount() > 0);
3053
}
3154
}

0 commit comments

Comments
 (0)