Posted by Areric on 04/12/06 01:19
OK all. Still having issues im going to copy the real code this time
since i have access to it.
class ImageModifierTest //implements ITest
{
var $imageModifier = NULL;
var $testHelpers = NULL;
function __construct()
{
$imageModifier = new ImageModifier();
$testHelpers = new TestHelpers();
}
function ImageModifierTest()
{
$this->__construct();
}
function TestOpenBinaryStream()
{
$streamToSend = "111010001010001";
return $this->imageModifier->OpenBinaryStream($streamToSend);
//THE ABOVE LINE IS WHERE IT ERRORS
return $this->testHelpers->AssertAreEqual($binaryStream,
$streamToSend);
}
function GetBinaryStreamFromFile()
{
$this->imageModifier->SetImageFile('/srv/www/htdocs/images/testpng.png');
$this->imageModifier->CreateBinaryStreamFromFile();
return
$this->testHelpers->AssertIsNotEmpty($this->imageModifier->GetBinaryImageStream);
}
function ExecuteTests()
{
$success = ($this->TestOpenBinaryStream()) &&
($this->GetBinaryStreamFromFile());
if ($success == true)
{
return "Success";
}
else
{
return "Failure";
}
}
}
class ImageModifier
{
//MEMBERS
var $mImage = "";
var $mModifiedImage = "";
var $mBinaryImageStream = "";
function __construct()
{
}
function SetImageFile($image)
{
$this->mImage = $image;
}
function OpenBinaryStream($stream)
{
$this->mImage = $stream;
$this->mBinaryImageStream = $stream;
return $this->mImage;
}
function CreateBinaryStreamFromFile()
{
$fp = fopen($this->mImage, 'rb');
header("Content-Type: image/png");
header("Content-Length: " . filesize($this->mImage));
$this->mBinaryImageStream = file_get_contents($this->mImage);
}
function GetBinaryImageStream()
{
return $this->mBinaryImageStream;
}
}
Note i converted my __construct to the method suggested above. I also
got rid of the &s. Im using PHP4 at the moment.
Navigation:
[Reply to this message]
|