@@ -41,6 +41,13 @@ abstract class AbstractBackendController extends \Magento\TestFramework\TestCase
41
41
*/
42
42
protected $ httpMethod ;
43
43
44
+ /**
45
+ * Expected no access response
46
+ *
47
+ * @var int
48
+ */
49
+ protected $ expectedNoAccessResponseCode = 403 ;
50
+
44
51
/**
45
52
* @inheritDoc
46
53
*
@@ -84,21 +91,6 @@ protected function tearDown()
84
91
parent ::tearDown ();
85
92
}
86
93
87
- /**
88
- * Utilize backend session model by default
89
- *
90
- * @param \PHPUnit\Framework\Constraint\Constraint $constraint
91
- * @param string|null $messageType
92
- * @param string $messageManagerClass
93
- */
94
- public function assertSessionMessages (
95
- \PHPUnit \Framework \Constraint \Constraint $ constraint ,
96
- $ messageType = null ,
97
- $ messageManagerClass = \Magento \Framework \Message \Manager::class
98
- ) {
99
- parent ::assertSessionMessages ($ constraint , $ messageType , $ messageManagerClass );
100
- }
101
-
102
94
/**
103
95
* Test ACL configuration for action working.
104
96
*/
@@ -111,8 +103,8 @@ public function testAclHasAccess()
111
103
$ this ->getRequest ()->setMethod ($ this ->httpMethod );
112
104
}
113
105
$ this ->dispatch ($ this ->uri );
114
- $ this ->assertNotSame (403 , $ this ->getResponse ()->getHttpResponseCode ());
115
106
$ this ->assertNotSame (404 , $ this ->getResponse ()->getHttpResponseCode ());
107
+ $ this ->assertNotSame ($ this ->expectedNoAccessResponseCode , $ this ->getResponse ()->getHttpResponseCode ());
116
108
}
117
109
118
110
/**
@@ -130,6 +122,6 @@ public function testAclNoAccess()
130
122
->getAcl ()
131
123
->deny (null , $ this ->resource );
132
124
$ this ->dispatch ($ this ->uri );
133
- $ this ->assertSame (403 , $ this ->getResponse ()->getHttpResponseCode ());
125
+ $ this ->assertSame ($ this -> expectedNoAccessResponseCode , $ this ->getResponse ()->getHttpResponseCode ());
134
126
}
135
127
}
0 commit comments