@@ -63,20 +63,12 @@ public function setUp()
6363 ->getMock ()
6464 ;
6565
66- $ this ->entityManager
67- ->expects ($ this ->once ())
68- ->method ('getRepository ' )
69- ->with ($ this ->className )
70- ->willReturn ($ this ->repository )
71- ;
72-
7366 $ this ->instance = new TokenManager ($ this ->entityManager , $ this ->className );
7467 }
7568
7669 public function testConstructWillSetParameters ()
7770 {
7871 $ this ->assertAttributeSame ($ this ->entityManager , 'em ' , $ this ->instance );
79- $ this ->assertAttributeSame ($ this ->repository , 'repository ' , $ this ->instance );
8072 $ this ->assertAttributeSame ($ this ->className , 'class ' , $ this ->instance );
8173 }
8274
@@ -112,6 +104,13 @@ public function testFindTokenBy()
112104 \random_bytes (5 ),
113105 ];
114106
107+ $ this ->entityManager
108+ ->expects ($ this ->once ())
109+ ->method ('getRepository ' )
110+ ->with ($ this ->className )
111+ ->willReturn ($ this ->repository )
112+ ;
113+
115114 $ this ->repository
116115 ->expects ($ this ->once ())
117116 ->method ('findOneBy ' )
@@ -174,6 +173,13 @@ public function testDeleteExpired()
174173 {
175174 $ randomResult = \random_bytes (10 );
176175
176+ $ this ->entityManager
177+ ->expects ($ this ->once ())
178+ ->method ('getRepository ' )
179+ ->with ($ this ->className )
180+ ->willReturn ($ this ->repository )
181+ ;
182+
177183 $ queryBuilder = $ this ->getMockBuilder (QueryBuilder::class)
178184 ->disableOriginalConstructor ()
179185 ->getMock ()
0 commit comments