[prev in list] [next in list] [prev in thread] [next in thread]
List: owncloud
Subject: Re: [Owncloud] Making internal methods public for unit testing
From: Beni Buess <beni () benel ! net>
Date: 2012-06-12 18:42:24
Message-ID: 20120612204224.78af5dc2 () nyr
[Download RAW message or body]
On Fri, 01 Jun 2012 18:38:12 +0100
Sam Tuke <samtuke@fsfe.org> wrote:
> OCP\User currently provides access to user-related methods commonly
> used by apps. For unit testing however, access to more methods are
> required, such as useBackend(), in order to make use of the dummy
> OC_User_Dummy user management backend.
>
> I imagine that other methods will also require access via a public
> interface for unit testing other functionality (not just relating to
> user.php).
>
> Therefore, although I can provide access to unit tests by simply
> adding wrappers for methods like useBackend() to OCP\User, I wonder
> whether there is a better option which doesn't result in a slew of
> new wrappers duplicating input and output?
You can use PHP's Reflection API. Using ReflectionMethod::setAccessible
you can make a private Method callable from outside [1]
[1] http://ch2.php.net/manual/en/reflectionmethod.setaccessible.php
Beni
_______________________________________________
Owncloud mailing list
Owncloud@kde.org
https://mail.kde.org/mailman/listinfo/owncloud
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic