Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Edited tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klapuch committed Jan 15, 2017
1 parent 82a0b46 commit 7dfd716
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Tests/Unit/StoredCsrf.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ final class StoredCsrf extends Tester\TestCase {
$this->get
))->protection();
Assert::match('~^[a-z0-9]+$~i', $protection);
}

public function testGeneratedLongEnoughProtection() {
$protection = (new Csrf\StoredCsrf(
$this->session,
$this->post,
$this->get
))->protection();
Assert::true(strlen($protection) >= 20);
}

Expand All @@ -41,7 +49,7 @@ final class StoredCsrf extends Tester\TestCase {
Assert::same($oldSession, $newSession);
}

public function testStoringProtection() {
public function testStoringProtectionToAppropriateStorage() {
(new Csrf\StoredCsrf(
$this->session,
$this->post,
Expand All @@ -61,7 +69,7 @@ final class StoredCsrf extends Tester\TestCase {
Assert::contains($protection, $this->session);
}

public function testNoProvidedProtection() {
public function testAbusingOnNoProvidedProtection() {
Assert::true(
(new Csrf\StoredCsrf(
$this->session,
Expand All @@ -71,7 +79,7 @@ final class StoredCsrf extends Tester\TestCase {
);
}

public function testNoMatchingProtectionInPostOrGet() {
public function testAbusingOnNoMatchingProtectionInPostOrGet() {
$csrf = new Csrf\StoredCsrf($this->session, $this->post, $this->get);
$csrf->protection();
Assert::true($csrf->abused());
Expand Down

0 comments on commit 7dfd716

Please sign in to comment.