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') + ); + } +} + +?>