11
11
use Magento \Ui \Api \Data \BookmarkInterface ;
12
12
13
13
/**
14
- * @magentoDataFixture Magento/Customer/_files/customer.php
14
+ * @magentoAppIsolation enabled
15
+ * @magentoAppArea adminhtml
15
16
*/
16
17
class BookmarkRepositoryTest extends \PHPUnit_Framework_TestCase
17
18
{
@@ -30,22 +31,39 @@ class BookmarkRepositoryTest extends \PHPUnit_Framework_TestCase
30
31
*/
31
32
protected $ bookmark ;
32
33
34
+ /**
35
+ * @var \Magento\Customer\Api\CustomerRepositoryInterface
36
+ */
37
+ protected $ customerRepository ;
38
+
33
39
protected function setUp ()
34
40
{
35
41
$ this ->bookmarkRepository = Bootstrap::getObjectManager ()
36
42
->create ('Magento\Ui\Model\Resource\BookmarkRepository ' );
37
43
$ this ->bookmarkFactory = Bootstrap::getObjectManager ()->create ('Magento\Ui\Model\BookmarkFactory ' );
44
+
38
45
/** @var $customerRepository \Magento\Customer\Api\CustomerRepositoryInterface */
39
- $ customerRepository = Bootstrap::getObjectManager ()
46
+ $ this -> customerRepository = Bootstrap::getObjectManager ()
40
47
->create ('Magento\Customer\Api\CustomerRepositoryInterface ' );
41
- $ customerId = $ customerRepository ->get ('customer@example.com ' )->getId ();
42
- $ this ->bookmark = $ this ->bookmarkFactory ->create ()->setUserId ($ customerId )->setTitle ('test ' );
48
+ $ newCustomerEntity = Bootstrap::getObjectManager ()
49
+ ->create ('Magento\Customer\Api\Data\CustomerInterfaceFactory ' )
50
+ ->create ()
51
+ ->setStoreId (1 )
52
+ ->setWebsiteId (1 )
53
+ ->setEmail ('bookmark_user@example.com ' )
54
+ ->setFirstname ('TestFn ' )
55
+ ->setLastname ('TestLn ' )
56
+ ->setGroupId (1 );
57
+ $ newCustomerEntity = $ this ->customerRepository ->save ($ newCustomerEntity );
58
+
59
+ $ this ->bookmark = $ this ->bookmarkFactory ->create ()->setUserId ($ newCustomerEntity ->getId ())->setTitle ('test ' );
43
60
$ this ->bookmark = $ this ->bookmarkRepository ->save ($ this ->bookmark );
44
61
}
45
62
46
63
protected function tearDown ()
47
64
{
48
65
$ this ->bookmarkRepository ->delete ($ this ->bookmark );
66
+ $ this ->customerRepository ->delete ($ this ->customerRepository ->get ('bookmark_user@example.com ' ));
49
67
}
50
68
51
69
public function testGetList ()
0 commit comments