[TYPO3-english] phpUnit and old-school extensions

Stefan Frömken firma at sfroemken.de
Sat Jul 30 16:01:14 CEST 2011


Oh dear...I have much to learn the next few days or maybe weeks :-)
I tried too much the last hours, so thank you for your hint. This test 
works now :-)
I found out that the testing functions have to be public.

Stefan

Am 30.07.2011 15:44, schrieb Søren Malling:
> Hi
>
> I don't know that much about phpunit, but it seems that you object variable
> is wrong.
>
> Use $this->obj instead of $obj
>
> Regards
>
> Søren
>
> On Saturday, July 30, 2011, Stefan Frömken<firma at sfroemken.de>  wrote:
>> Hello list,
>>
>> I'm just learning to use phpUnit to programm more stable extension and I
> have programmed my first little Array-Test without any problems. But now I
> will go one step further and I will test if my Objekt tx_sfimmo_pi1 has a
> special property set. There is a phpUnit-function which makes this possible:
>>
>> require_once(t3lib_extMgm::extPath('sfimmo') .
> 'pi1/class.tx_sfimmo_pi1.php');
>>
>> /**
>>   * @test
>>   */
>> public function init() {
>>         $this->obj = new tx_sfimmo_pi1;
>>         $this->assertObjectHasAttribute('subpartArray', $obj, 'Attribute
> not found in this Object');
>>         //$this->assertClassHasAttribute('subpartArray', 'tx_sfimmo_pi1',
> 'Attribute not found in this Class');
>> }
>>
>> There is no problem with my commented line (classHasAttribute). I think
> there is a problem with creating an instance of my Class tx_sfimmo_pi1.
>>
>> Maybe you have an idea how to create an instance of my plugin here in my
> test class.
>>
>> PHPUnit shows a fail but without any more informations for debugging.
>>
>> Stefan
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>
>



More information about the TYPO3-english mailing list