Unit testing CakePHP 3.x Basic Authorization Login -


i want test workings , functionality of basic cakephp 3.x authentication form, , associated logic behind action. however, have gone round , round trying write unit test login page generated cakephp 3.x - know, completeness of code coverage - , have found available information lacking or absent.

i can find plenty of information unit testing login form on cakephp 2.x, useless because of changes between cakephp 2.x & 3.x. can point me detailed information regarding, or provide explanation of, testing login page?

edit not looking tutorials (but not gonna turn them away if expose requested info), tools, or other shortcuts; don't want/need copy & paste solution. looking more info data structures can put unit test together.

edit 2 attempting accomplish this cakephp 3.x instead.

check out!

public function testaddunauthenticatedfails() {     // no session data set.     $this->get('/articles/add');      $this->assertredirect(['controller' => 'users', 'action' => 'login']); }  public function testaddauthenticated() {     // set session data     $this->session([         'auth' => [             'user' => [                 'id' => 1,                 'username' => 'testing',                 // other keys.             ]         ]     ]);     $this->get('/articles/add');      $this->assertresponseok();     // other assertions. } 

copied cake 3 cookbook on testing

edit:

didn't realize question testing of interns of authentication - here's link that: https://github.com/cakephp/cakephp/tree/master/tests/testcase/auth


Comments