2222use Magento \User \Block \Role \Grid \User ;
2323use Magento \User \Controller \Adminhtml \User \Role \SaveRole ;
2424use Magento \User \Model \ResourceModel \Role \User \CollectionFactory ;
25+ use Magento \Framework \Escaper ;
2526use PHPUnit \Framework \MockObject \MockObject ;
2627use PHPUnit \Framework \TestCase ;
2728
@@ -82,6 +83,11 @@ class UserTest extends TestCase
8283 */
8384 protected $ filesystemMock ;
8485
86+ /**
87+ * @var Escaper|MockObject
88+ */
89+ protected $ escaperMock ;
90+
8591 protected function setUp (): void
8692 {
8793 $ this ->backendHelperMock = $ this ->getMockBuilder (Data::class)
@@ -123,6 +129,10 @@ protected function setUp(): void
123129 ->disableOriginalConstructor ()
124130 ->getMock ();
125131
132+ $ this ->escaperMock = $ this ->getMockBuilder (Escaper::class)
133+ ->disableOriginalConstructor ()
134+ ->getMockForAbstractClass ();
135+
126136 $ objectManagerHelper = new ObjectManager ($ this );
127137 $ this ->model = $ objectManagerHelper ->getObject (
128138 User::class,
@@ -135,7 +145,8 @@ protected function setUp(): void
135145 'request ' => $ this ->requestInterfaceMock ,
136146 'urlBuilder ' => $ this ->urlInterfaceMock ,
137147 'layout ' => $ this ->layoutMock ,
138- 'filesystem ' => $ this ->filesystemMock
148+ 'filesystem ' => $ this ->filesystemMock ,
149+ 'escaper ' => $ this ->escaperMock
139150 ]
140151 );
141152 }
@@ -302,4 +313,14 @@ public function testGetUsersIncorrectInRoleUser(): void
302313 $ this ->requestInterfaceMock ->expects ($ this ->once ())->method ('getParam ' )->with ($ param )->willReturn ($ paramValue );
303314 $ this ->assertEquals ('{} ' , $ this ->model ->getUsers (true ));
304315 }
316+
317+ /**
318+ * @return void
319+ */
320+ public function testGetUsers (): void
321+ {
322+ $ paramValue = array ("1 " );
323+ $ this ->requestInterfaceMock ->expects ($ this ->once ())->method ('getParam ' )->with ('in_role_user ' )->willReturn ($ paramValue );
324+ $ this ->assertEquals ($ paramValue , $ this ->model ->getUsers ());
325+ }
305326}
0 commit comments