[TYPO3-core] RFC #14264: cObj + PHPunit - Problem with cwd

Stefan Geith typo3dev2010.nospam1 at geithware.de
Fri May 7 10:31:04 CEST 2010


Hi Susanne,

Susanne Moog schrieb:
> I'm sorry, but I don't get the problem / your solution. In your testcase
> you compare $imgRes to $result[3] (which obviously can't work before
> applying your second patch as there is no $result[3]):

Try testing Image-Rendering with a Testcase in PHPunit,
e.g. cObj->IMAGE(Array('file'=>'typo3conf/ext/plugin/test.gif'))

This will not work because, PHPunit runs in a different working
directory than the Typo3 FE. And cObj->IMAGE needs the relative
path to the image in $info[3].

Tracking this, you will find out, that $result[3] is set by
gifCreator->imageMagickConvert($theImage) but ONLY if paths
are correct (=FE).

If I then change the (relative) pats to absolute paths,
$result[3] also contains this absolute path, which would
be false, because this value is used to render the <img>-tag.

Hope, this clarifies the problem a bit...

If not: try to write a test for a simple IMAGE or IMGRESOURCE
and try to track, why this Test will fail:
e.g.
   public function getImageResource() {
     ...
     $imgRes = 'EXT:cms/ext_icon.gif';
     $expected = 'typo3/sysext/cms/ext_icon.gif';
     $result = $this->cObj->IMG_RESOURCE(Array('file'=>$imgRes));
     $this->assertEquals($expected, $result);
   }


/Stefan






More information about the TYPO3-team-core mailing list