Skip to content

Commit

Permalink
fix(Auth): unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TiSiE committed Apr 1, 2021
1 parent 59895b3 commit 56ff4d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions module/Auth/test/AuthTest/Controller/ManageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function testAccessWhenNotLoggedIn()

$result = $this->getResponse()->getContent();

$this->assertNotRedirect();
$this->assertResponseStatusCode(Response::STATUS_CODE_401);
$this->assertContains('Please authenticate yourself to proceed', $result);
$this->assertRedirect();
$this->assertResponseStatusCode(Response::STATUS_CODE_303);
$this->assertRedirectRegex('~/login\?ref=.*?profile~');
}

public function testAccessWhenLoggedIn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function setUp(): void
->will($this->returnValueMap([
[ 'Organizations/OrganizationImage', $orgImageRepo ]
]));

$manager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock()
Expand Down Expand Up @@ -73,8 +73,8 @@ public function testAccessWhenYouAreLogged()
->with('Organizations/OrganizationImage')
->willReturn($repository)
;*/


$this->authenticateUser();
$this->dispatch(self::URL_MY_PASSWORD, Request::METHOD_GET);
$result = $this->getResponse()->getContent();
Expand All @@ -83,18 +83,18 @@ public function testAccessWhenYouAreLogged()
$this->assertResponseStatusCode(Response::STATUS_CODE_200);
$this->assertContains('My password', $result);
}

public function testAccessWhenYouAreNotLoggedIn()
{
$this->dispatch(self::URL_MY_PASSWORD, Request::METHOD_GET);

$result = $this->getResponse()->getContent();
$this->assertNotRedirect();
$this->assertResponseStatusCode(Response::STATUS_CODE_401);
$this->assertContains('Please authenticate yourself to proceed', $result);

$this->assertRedirect();
$this->assertRedirectRegex('~/login\?ref=.*?password~');
$this->assertResponseStatusCode(Response::STATUS_CODE_303);
}

/**
* Assert response status code
*
Expand Down

0 comments on commit 56ff4d4

Please sign in to comment.