[Owncloud] Unit Testing an App -- app can't find appframework

Sarah Jones sarah.e.p.jones at gmail.com
Fri Jan 25 00:52:09 UTC 2013


On 1/24/13 3:26 PM, Bernhard Posselt wrote:
> On 01/25/2013 12:20 AM, Sarah Jones wrote:
>> Hi,
>>
>> I've copied the apptemplate_advanced and started on my app.  I've
>> enabled the AppFramework and my app in my owncloud install.
>>
>> I based my FriendshipMapper class off of the ItemMapper class in the
>> apptemplate_advanced.  I am basing FriendshipMapperTest off of the
>> appframework MapperTest (since there were no db unit tests samples in
>> apptemplate or apptemplate_advanced).
>>
>> When I try to run my test for my mapper class (e.g. `phpunit
>> tests/friendship/FriendshipMapperTest.php`), I get
>> PHP Fatal error:  Class 'OCA\AppFramework\Mapper' not found in
>> /home/sjones/public_html/dev/myapps/friends/database/friendship.mapper.php
>> on line 26
>>
>> Line 26 of friendship.mapper.php is
>> class FriendshipMapper extends \OCA\AppFramework\Mapper {
>>
>> http://doc.owncloud.org/server/5.0/developer_manual/tutorial.html#unittests
>> says that the app tests should be app to run in isolation from the
>> owncloud instance with just the appframework.
>>
>> How should the my app know where the appframework is?
>>
>> Thanks,
>> ~Sarah
>>
>>
>>
>> _______________________________________________
>> Owncloud mailing list
>> Owncloud at kde.org
>> https://mail.kde.org/mailman/listinfo/owncloud
> ehm, after rethinking it it should be
>
> require_once(__DIR__ . "/../classloader.php");
>
>
> Also you're missing an additional namespace for the mapper:
>
> class FriendshipMapper extends \OCA\AppFramework\Mapper {
>
> should be
>
> class FriendshipMapper extends \OCA\AppFramework\Db\Mapper {
>
>
> We had to change that recently due to the fact that the classloader
> would fail if the appsdirectory wasnt named apps/
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
On the top of the test file?

Aw, I didn't catch that.  I did a git pull and a diff to copy the 
changes over to my app...any suggestions for a cleaner way to stay updated?

Thanks for answering!



More information about the Owncloud mailing list