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

Bernhard Posselt nukeawhale at gmail.com
Thu Jan 24 23:18:02 UTC 2013


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
You have to include the classloader at the top of your file. Also check
if the directory is correct, i suppose you miss a ../:

require_once(__DIR__ . "/../../classloader.php");


Then the appframework classes should be loaded without problems based on
their namespace.




More information about the Owncloud mailing list