Midgard and PhPUnit
-
Bouteille, Pierre-marie
Midgard and PhPUnit
Wed June 16 2010 14:25:06 UTCHi all,
We need to use PHPUnit to perform unit test of our application that is using Midgard.
Basically we are facing problem due to file inclusion ... Midgard manages inclusion through midgard-root.php but when using PHPUnit we directly call method ...
Is there anyone that can provide us some hints on how to do ?
Is there a document somewhere explaining how to do ?
Any help would be appreciable ...
Regards
Pierre-Marie
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user -
Re: [midgard-user] Midgard and PhPUnit
Wed June 16 2010 14:35:03 UTCHi!
On Wed, Jun 16, 2010 at 1:17 PM, Bouteille, Pierre-marie
<Pierre-Marie.Bouteille@hp.com> wrote:
> We need to use PHPUnit to perform unit test of our application that is using
> Midgard.
>
> Basically we are facing problem due to file inclusion Midgard manages
> inclusion through midgard-root.php but when using PHPUnit we directly call
> method
I assume the application is using Midgard1 (versions up until Midgard
8.09 "Ragnaroek"). In Midgard2 we have a PHPunit test environment
bundled with the system, but with Midgard1 it is unfortunately a bit
trickier.
Tarjei Huse was working on a unit testing environment for MidCOM in
http://trac.midgard-project.org/browser/branches/thor/midcom/midcom.tests.base
which might be possible to bring back to life.
BTW, would be interesting to hear a bit more about your Midgard application :-)
> Pierre-Marie
/Henri
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.bergius@gmail.com
Microblog: http://www.qaiku.com/home/bergie/
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user -
Bouteille, Pierre-marie
Re: [midgard-user] Midgard and PhPUnit
Fri June 18 2010 09:05:05 UTCHi Henri,
Thanks for your answer ...
Our application is an internal application used by thousands of users to manage client environments ... It's a kind of placeholder to share client environment knowledge (data, documents, contacts, ...) with some more functionalities (read/write access, wiki, ...). It's now an 8 years old application that really help people to collaborate to solve/manage our clients...
I come back to my problem.
We are using midgard-core-1.8.9.2-1.x86_64.rpm ... I must admit I'm new to this project and don't master everything yet ...
The problem I saw when trying to put in place PHPUnit is due to Midgard Page construction ... In fact, from what I understand, Midgard allows to build a page by replacing references to other elements by their contents (http://www.midgard-project.org/documentation/concepts-page_and_style/) ...
Because PHPUnit directly call a given element, for sure we will miss references to other elements ...
What you're pointed to me seems more PHPUnit of MidCOM itself but not PHPUnit of an application using Midgard ...
We really wonder how to do ? ... What's the right approach ? ... and definitely need some help, some guidance on this topic ... so we really appreciate if you could help us ?
Regards
Pierre-Marie
-----Original Message-----
From: henri.bergius@gmail.com [mailto:henri.bergius@gmail.com] On Behalf Of Henri Bergius
Sent: Wednesday, June 16, 2010 4:29 PM
To: Midgard user list
Cc: Bouteille, Pierre-marie
Subject: Re: [midgard-user] Midgard and PhPUnit
Hi!
On Wed, Jun 16, 2010 at 1:17 PM, Bouteille, Pierre-marie
<Pierre-Marie.Bouteille@hp.com> wrote:
> We need to use PHPUnit to perform unit test of our application that is using
> Midgard.
>
> Basically we are facing problem due to file inclusion ... Midgard manages
> inclusion through midgard-root.php but when using PHPUnit we directly call
> method ...
I assume the application is using Midgard1 (versions up until Midgard
8.09 "Ragnaroek"). In Midgard2 we have a PHPunit test environment
bundled with the system, but with Midgard1 it is unfortunately a bit
trickier.
Tarjei Huse was working on a unit testing environment for MidCOM in
http://trac.midgard-project.org/browser/branches/thor/midcom/midcom.tests.base
which might be possible to bring back to life.
BTW, would be interesting to hear a bit more about your Midgard application :-)
> Pierre-Marie
/Henri
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.bergius@gmail.com
Microblog: http://www.qaiku.com/home/bergie/
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user -
Re: [midgard-user] Midgard and PhPUnit
Fri June 18 2010 09:25:04 UTCHi!
> Our application is an internal application used by thousands of users to manage client environments...
Good to hear Midgard feels well in large setups :)
BTW, there's OpenPSA2 CRM: http://www.openpsa2.org.
It's not officially announced, but it's used by companies like HP or
Lufthansa.
> We are using midgard-core-1.8.9.2-1.x86_64.rpm ... I must admit I'm new to this project and don't master everything yet ...
> The problem I saw when trying to put in place PHPUnit is due to Midgard Page construction ... In fact, from what I understand, Midgard allows to build a page by replacing references to other elements by their contents (http://www.midgard-project.org/documentation/concepts-page_and_style/) ...
> Because PHPUnit directly call a given element, for sure we will miss references to other elements ...
Yeah, elements are kept in memory, so no single file is involved here.
I wonder if you could try with cache files, usually stored in
/var/cache/midgard.
Convention to file naming is: host_id-page_id-style_id-lang.
Those files should contain midgard-root.php file "extracted".
Piotras
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user -
Re: [midgard-user] Midgard and PhPUnit
Fri June 18 2010 10:05:02 UTCHi,
On Fri, Jun 18, 2010 at 12:14 PM, Piotr Pokora <piotrek.pokora@gmail.com> wrote:
>> Our application is an internal application used by thousands of users to manage client environments...
I had heard rumors of this before. The typical situation with Open
Source is that you can't really know who is using your software. So,
cool! Very nice to hear of this.
> Yeah, elements are kept in memory, so no single file is involved here.
> I wonder if you could try with cache files, usually stored in
> /var/cache/midgard.
The other option (and probably better) would be to have unit tests for
actual classes of the application. Are they handled in filesystem or
snippets?
In this case the Midgard MVC unit test setup might be possible to
adapt to your use:
http://trac.midgard-project.org/browser/trunk/midgardmvc/tests
(note: this code uses Midgard2, so quite a few changes needed to work with 1.8)
> Piotras
/Bergie
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.bergius@gmail.com
Microblog: http://www.qaiku.com/home/bergie/
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user -
Re: [midgard-user] Midgard and PhPUnit
Fri June 18 2010 13:45:03 UTCHi,
On Fri, Jun 18, 2010 at 12:36 PM, Henri Bergius <henri.bergius@iki.fi> wrote:
> In this case the Midgard MVC unit test setup might be possible to
> adapt to your use:
I just refactored Midgard MVC's PHPUnit test harness a bit. Basically
your application would need something similar to
http://github.com/midgardproject/midgardmvc_core/blob/master/tests/midgard.php
...then just write your PHPUnit testcases inheriting from that class.
Note that this version uses the methods for opening a Midgard
connection that are present from Midgard 8.09 onwards (and in
Midgard2), so they need to be rewritten to use the classic Midgard
connection API.
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.bergius@gmail.com
Microblog: http://www.qaiku.com/home/bergie/
_______________________________________________
user mailing list
user@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/user
