|
7 | 7 | namespace Magento\Ui\Model\Resource;
|
8 | 8 |
|
9 | 9 | use Magento\TestFramework\Helper\Bootstrap;
|
| 10 | +use Magento\Ui\Api\BookmarkRepositoryInterface; |
| 11 | +use Magento\Ui\Api\Data\BookmarkInterface; |
10 | 12 |
|
11 | 13 | class BookmarkRepositoryTest extends \PHPUnit_Framework_TestCase
|
12 | 14 | {
|
13 | 15 | /**
|
14 |
| - * @var BookmarkRepository |
| 16 | + * @var BookmarkRepositoryInterface |
15 | 17 | */
|
16 | 18 | protected $bookmarkRepository;
|
17 | 19 |
|
| 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 | + */ |
18 | 33 | protected function setUp()
|
19 | 34 | {
|
20 | 35 | $this->bookmarkRepository = Bootstrap::getObjectManager()
|
21 | 36 | ->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); |
22 | 45 | }
|
23 | 46 |
|
24 |
| - public function testGetListEmpty() |
| 47 | + public function testGetList() |
25 | 48 | {
|
26 | 49 | /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */
|
27 | 50 | $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); |
30 | 53 | }
|
31 | 54 | }
|
0 commit comments