Reply to Re: OO PHP Referencing an instance of a class

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация