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

Bernhard Posselt nukeawhale at gmail.com
Fri Jan 25 11:38:21 UTC 2013


Good question, i think there isnt one yet. Maybe there should be an additional mailinglist/newsfeed where i can publish changes to. A good indicator though are documentation changes in the tutorial. When i add/change something i usually update the docs right away.

But i think there wont be any more changes that break your app until the freeze. The big missing part is now only to integrate the api docs into the documentation.

Ps: ive added the possibility to use twig templates yesterday. Check the docs ;)

Sarah Jones <sarah.e.p.jones at gmail.com> schrieb:

>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!
>_______________________________________________
>Owncloud mailing list
>Owncloud at kde.org
>https://mail.kde.org/mailman/listinfo/owncloud


More information about the Owncloud mailing list