2222 *
2323 */
2424
25- namespace tests \Unit \ Mapper ;
25+ namespace tests \Integration \ Db ;
2626
2727
2828use ChristophWurst \Nextcloud \Testing \DatabaseTransaction ;
@@ -36,20 +36,20 @@ class FavoriteShareMapperTest extends TestCase {
3636 use DatabaseTransaction;
3737
3838 /* @var FavoriteShareMapper */
39- private $ favoriteShareMapper ;
39+ private $ mapper ;
4040
4141 public function setUp (): void {
4242 parent ::setUp ();
4343
44- $ this ->favoriteShareMapper = new FavoriteShareMapper (
44+ $ this ->mapper = new FavoriteShareMapper (
4545 OC ::$ server ->getDatabaseConnection (),
4646 OC ::$ server ->getSecureRandom ()
4747 );
4848 }
4949
5050 public function testCreateByOwnerAndTokenIsSuccessful () {
5151 /* @var FavoriteShare */
52- $ share = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory " );
52+ $ share = $ this ->mapper ->create ("testUser " , "testCategory " );
5353
5454 $ this ->assertIsString ($ share ->getToken ());
5555 $ this ->assertEquals ("testUser " , $ share ->getOwner ());
@@ -58,10 +58,10 @@ public function testCreateByOwnerAndTokenIsSuccessful() {
5858
5959 public function testFindByTokenIsSuccessful () {
6060 /* @var FavoriteShare */
61- $ shareExpected = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory " );
61+ $ shareExpected = $ this ->mapper ->create ("testUser " , "testCategory " );
6262
6363 /* @var FavoriteShare */
64- $ shareActual = $ this ->favoriteShareMapper ->findByToken ($ shareExpected ->getToken ());
64+ $ shareActual = $ this ->mapper ->findByToken ($ shareExpected ->getToken ());
6565
6666 $ this ->assertEquals ($ shareExpected ->getToken (), $ shareActual ->getToken ());
6767 $ this ->assertEquals ($ shareExpected ->getOwner (), $ shareActual ->getOwner ());
@@ -70,10 +70,10 @@ public function testFindByTokenIsSuccessful() {
7070
7171 public function testFindByOwnerAndCategoryIsSuccessful () {
7272 /* @var FavoriteShare */
73- $ shareExpected = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory " );
73+ $ shareExpected = $ this ->mapper ->create ("testUser " , "testCategory " );
7474
7575 /* @var FavoriteShare */
76- $ shareActual = $ this ->favoriteShareMapper ->findByOwnerAndCategory ("testUser " , "testCategory " );
76+ $ shareActual = $ this ->mapper ->findByOwnerAndCategory ("testUser " , "testCategory " );
7777
7878 $ this ->assertEquals ($ shareExpected ->getToken (), $ shareActual ->getToken ());
7979 $ this ->assertEquals ($ shareExpected ->getOwner (), $ shareActual ->getOwner ());
@@ -82,15 +82,15 @@ public function testFindByOwnerAndCategoryIsSuccessful() {
8282
8383 public function testFindAllByOwnerIsSuccessfulAndDoesNotContainOtherShares () {
8484 /* @var FavoriteShare */
85- $ share1 = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory1 " );
85+ $ share1 = $ this ->mapper ->create ("testUser " , "testCategory1 " );
8686
8787 /* @var FavoriteShare */
88- $ share2 = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory2 " );
88+ $ share2 = $ this ->mapper ->create ("testUser " , "testCategory2 " );
8989
90- $ this ->favoriteShareMapper ->create ("testUser2 " , "testCategory " );
90+ $ this ->mapper ->create ("testUser2 " , "testCategory " );
9191
9292 /* @var array */
93- $ shares = $ this ->favoriteShareMapper ->findAllByOwner ("testUser " );
93+ $ shares = $ this ->mapper ->findAllByOwner ("testUser " );
9494
9595 $ shareTokens = array_map (function ($ share ) {
9696 return $ share ->getToken ();
@@ -103,7 +103,7 @@ public function testFindAllByOwnerIsSuccessfulAndDoesNotContainOtherShares() {
103103
104104 public function testFindOrCreateByOwnerAndCategoryIsSuccessful () {
105105 /* @var FavoriteShare */
106- $ share = $ this ->favoriteShareMapper ->findOrCreateByOwnerAndCategory ("testUser " , "testCategory " );
106+ $ share = $ this ->mapper ->findOrCreateByOwnerAndCategory ("testUser " , "testCategory " );
107107
108108 $ this ->assertIsString ($ share ->getToken ());
109109 $ this ->assertEquals ("testUser " , $ share ->getOwner ());
@@ -112,13 +112,13 @@ public function testFindOrCreateByOwnerAndCategoryIsSuccessful() {
112112
113113 public function testRemoveByOwnerAndCategoryIsSuccessful () {
114114 /* @var FavoriteShare */
115- $ share = $ this ->favoriteShareMapper ->create ("testUser " , "testCategory " );
115+ $ share = $ this ->mapper ->create ("testUser " , "testCategory " );
116116
117- $ this ->favoriteShareMapper ->removeByOwnerAndCategory ($ share ->getOwner (), $ share ->getCategory ());
117+ $ this ->mapper ->removeByOwnerAndCategory ($ share ->getOwner (), $ share ->getCategory ());
118118
119119 $ this ->expectException (DoesNotExistException::class);
120120
121- $ this ->favoriteShareMapper ->findByOwnerAndCategory ($ share ->getOwner (), $ share ->getCategory ());
121+ $ this ->mapper ->findByOwnerAndCategory ($ share ->getOwner (), $ share ->getCategory ());
122122 }
123123
124124}
0 commit comments