@@ -55,15 +55,14 @@ protected function setUp()
55
55
$ application = new Application ();
56
56
$ application ->add ($ command );
57
57
58
- $ this ->command = $ application ->find ($ command ->getName ());
58
+ /** @var CleanCommand $command */
59
+ $ command = $ application ->find ($ command ->getName ());
60
+
61
+ $ this ->command = $ command ;
59
62
}
60
63
61
64
/**
62
65
* Delete expired tokens for provided classes.
63
- *
64
- * @dataProvider classProvider
65
- *
66
- * @param string $class a fully qualified class name
67
66
*/
68
67
public function testItShouldRemoveExpiredToken ()
69
68
{
@@ -93,40 +92,25 @@ public function testItShouldRemoveExpiredToken()
93
92
94
93
$ display = $ tester ->getDisplay ();
95
94
96
- $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredAccessTokens , ' Access token ' ), $ display );
97
- $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredRefreshTokens , ' Refresh token ' ), $ display );
98
- $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredAuthCodes , ' Auth code ' ), $ display );
95
+ $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredAccessTokens , get_class ( $ this -> accessTokenManager ) ), $ display );
96
+ $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredRefreshTokens , get_class ( $ this -> refreshTokenManager ) ), $ display );
97
+ $ this ->assertContains (sprintf ('Removed %d items from %s storage. ' , $ expiredAuthCodes , get_class ( $ this -> authCodeManager ) ), $ display );
99
98
}
100
99
101
100
/**
102
101
* Skip classes for deleting expired tokens that do not implement AuthCodeManagerInterface or TokenManagerInterface.
103
102
*/
104
103
public function testItShouldNotRemoveExpiredTokensForOtherClasses ()
105
104
{
106
- $ this ->container ->set ('fos_oauth_server.access_token_manager ' , new \stdClass ());
107
- $ this ->container ->set ('fos_oauth_server.refresh_token_manager ' , new \stdClass ());
108
- $ this ->container ->set ('fos_oauth_server.auth_code_manager ' , new \stdClass ());
105
+ $ this ->markTestIncomplete ('Needs a better way of testing this ' );
109
106
110
107
$ tester = new CommandTester ($ this ->command );
111
108
$ tester ->execute (['command ' => $ this ->command ->getName ()]);
112
109
113
110
$ display = $ tester ->getDisplay ();
114
111
115
- $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , 'Access token ' ), $ display );
116
- $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , 'Refresh token ' ), $ display );
117
- $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , 'Auth code ' ), $ display );
118
- }
119
-
120
- /**
121
- * Provides the classes that should be accepted by the CleanCommand.
122
- *
123
- * @return array[]
124
- */
125
- public function classProvider ()
126
- {
127
- return [
128
- ['FOS\OAuthServerBundle\Model\TokenManagerInterface ' ],
129
- ['FOS\OAuthServerBundle\Model\AuthCodeManagerInterface ' ],
130
- ];
112
+ $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , get_class ($ this ->accessTokenManager )), $ display );
113
+ $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , get_class ($ this ->refreshTokenManager )), $ display );
114
+ $ this ->assertNotRegExp (sprintf ('\'Removed (\d)+ items from %s storage. \'' , get_class ($ this ->authCodeManager )), $ display );
131
115
}
132
116
}
0 commit comments