diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f6df9..01020eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,6 @@ * ADDED: Deletion URL. * small refactoring. * improved regex checks. - * larger server alt on installation. + * larger server alt on installation. diff --git a/lib/vizhash16x16.php b/lib/vizhash16x16.php index 52b1cfd..128091c 100644 --- a/lib/vizhash16x16.php +++ b/lib/vizhash16x16.php @@ -85,15 +85,6 @@ class vizhash16x16 return $imagedata; } - // Generate a large random hexadecimal salt. - private function randomSalt() - { - $randomSalt=''; - for($i=0;$i<6;$i++) { $randomSalt.=base_convert(mt_rand(),10,16); } - return $randomSalt; - } - - private function getInt() // Returns a single integer from the $VALUES array (0...255) { $v= $this->VALUES[$this->VALUES_INDEX]; @@ -101,6 +92,7 @@ class vizhash16x16 $this->VALUES_INDEX %= count($this->VALUES); // Warp around the array return $v; } + private function getX() // Returns a single integer from the array (roughly mapped to image width) { return $this->width*$this->getInt()/256; @@ -148,14 +140,9 @@ class vizhash16x16 $points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(),$this->getX(), $this->getY()); ImageFilledPolygon ($image, $points, 4, $color); break; - case 4: - case 5: - case 6: + default: $start=$this->getInt()*360/256; $end=$start+$this->getInt()*180/256; ImageFilledArc ($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(),$start,$end,$color,IMG_ARC_PIE); - break; } } } - -?> \ No newline at end of file diff --git a/tst/RainTPL.php b/tst/RainTPL.php index d6f31d6..39272e0 100644 --- a/tst/RainTPL.php +++ b/tst/RainTPL.php @@ -91,4 +91,13 @@ class RainTPLTest extends PHPUnit_Framework_TestCase 'outputs version correctly' ); } + + /** + * @expectedException RainTpl_Exception + */ + public function testMissingTemplate() + { + $test = new RainTPL; + $test->draw('123456789 does not exist!'); + } }