From dd2e6994fa3ea1edc6cae3dc2b6bbab480d164b1 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Fri, 3 Jan 2014 19:08:53 -0500 Subject: [PATCH] New test classes Forgot to commit them it seems. --- tests/classes/API/AYAHTest.php | 24 +++++++++++ tests/classes/API/GravatarTest.php | 66 ++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 tests/classes/API/AYAHTest.php create mode 100644 tests/classes/API/GravatarTest.php diff --git a/tests/classes/API/AYAHTest.php b/tests/classes/API/AYAHTest.php new file mode 100644 index 0000000..6c2f632 --- /dev/null +++ b/tests/classes/API/AYAHTest.php @@ -0,0 +1,24 @@ + diff --git a/tests/classes/API/GravatarTest.php b/tests/classes/API/GravatarTest.php new file mode 100644 index 0000000..bd790e1 --- /dev/null +++ b/tests/classes/API/GravatarTest.php @@ -0,0 +1,66 @@ +assertEquals($b, API_Gravatar::hash($a)); + } + + public function providerHash() + { + return [ + ['foo@bar.com', 'f3ada405ce890b6f8204094deb12d8a8'], + ['FOO@BAR.COM', 'f3ada405ce890b6f8204094deb12d8a8'], + ]; + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Invalid email address. + */ + public function testImgInvalidEmail() + { + API_Gravatar::img('invalidemail'); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Invalid size parameter, expecting an integer between 1 and 2048. + */ + public function testImgInvalidSize() + { + API_Gravatar::img('foo@bar.com', 2050); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Invalid default parameter, expecting gravatar, 404, mm, identicon, monsterid, wavatar, retro, blank or a valid URL. + */ + public function testImgInvalidDefault() + { + API_Gravatar::img('foo@bar.com', 80, 'invalid'); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Invalid rating perameter, expecting g, pg, r or x. + */ + public function testImgInvalidRating() + { + API_Gravatar::img('foo@bar.com', 80, 'gravatar', 'sexytime'); + } + + public function testImg() + { + $this->assertEquals( + '', + API_Gravatar::img('foo@bar.com') + ); + } +} + +?>