public function testItWillReturnItsContents() { $types = array('png' => 'png', 'jpg' => 'jpeg', 'gif' => 'gif'); foreach ($types as $ext => $command) { $image = new GDImage(__DIR__ . "/fixtures/image." . $ext); $in = "imagecreatefrom" . $command; $out = "image" . $command; // This sucks. I hate it. $actual = $in(__DIR__ . "/fixtures/image." . $ext); ob_start(); $out($actual); $expected = ob_get_clean(); $this->assertEquals($expected, $image->getContents()); } }