From 7dfd716b41335ece36cf59286e0514aa7f9ab247 Mon Sep 17 00:00:00 2001 From: Dominik Klapuch Date: Sun, 15 Jan 2017 09:55:46 +0100 Subject: [PATCH] Edited tests --- Tests/Unit/StoredCsrf.phpt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Tests/Unit/StoredCsrf.phpt b/Tests/Unit/StoredCsrf.phpt index e2df650..42807b7 100644 --- a/Tests/Unit/StoredCsrf.phpt +++ b/Tests/Unit/StoredCsrf.phpt @@ -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); } @@ -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, @@ -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, @@ -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());