From: Rodrigo S. P. <rod...@gm...> - 2009-08-10 18:23:36
|
Hi Marta, thanks for your feedback. I think that now I was able to fix the errors you mentioned. Please could you test and report if all the tiki importer tests are passing for you? I have change the tests so that now it should you the Text_Wiki package that is distributed with Tikiwiki and I think this will solve the first error you mentioned (unable to open required files). By mistake I was using a file that I have on my local machine to test the method downloadAttachments(). Now I have changed it to create a file on the fly and use this file for the tests. I think that the best way to test this method is using PHPUnit file system mocking capabilities but when I read about this it appeared to be a little bit complicated and I gave up. About the error on the acceptances tests, Alain mentiond a while ago (before I moved some tests to lib/test) that they were failing. Maybe this is the problem. If you think it might be something related with the change I made please let me know. Cheers, Rodrigo. On Fri, Aug 7, 2009 at 6:49 PM, Marta Stojanovic <mar...@gm... > wrote: > Hi Rodrigo, > > On my machine I get the following error when running : > > C:\eclipse_workspace\TikiWikiTrunk\lib\test>phpunit AllTests.php (same > if I run AllTests in the importer directory) > > Warning: require_once(Text/Wiki/Mediawiki.php): failed to open stream: No > such f > ile or directory in > C:\eclipse_workspace\TikiWikiTrunk\lib\importer\tikiimporter > _wiki_mediawiki.php on line 4 > > Fatal error: require_once(): Failed opening required > 'Text/Wiki/Mediawiki.php' ( > include_path='.;C:\wamp\bin\php\php5.2.9-2\pear') in > C:\eclipse_workspace\TikiWi > kiTrunk\lib\importer\tikiimporter_wiki_mediawiki.php on line 4 > > When I included '../pear' in the include path (at the beginning of the > AllTests.php file) the tests run (although with some failures): > > ini_set( 'include_path', ini_get('include_path') . PATH_SEPARATOR . > '.' . PATH_SEPARATOR . '../pear'); > > We put a line similar to the above for the acceptance tests. You might > have set up your development env differently and on your machine it > doesn't complain. Could you check what you have on your machine for > include_path? > > Here are the tests that fail: > > There were 2 failures: > > 1) testDownloadAttachment(TikiImporter_Wiki_Mediawiki_Test) > Failed asserting that file > "C:\eclipse_workspace\TikiWikiTrunk\lib\test\importer > /fixtures/Qlandkartegt-0.11.1.tar.gz" exists. > > C:\eclipse_workspace\TikiWikiTrunk\lib\test\importer\tikiimporter_wiki_mediawiki > _test.php:139 > > 2) > testDownloadAttachmentsShouldDisplayMessageIfUnableToDownloadFile(TikiImporte > r_Wiki_Mediawiki_Test) > Failed asserting that two strings are equal. > --- Expected > +++ Actual > @@ -1,5 +1,5 @@ > > > Starting to import attachments: > -Unable to download file Qlandkartegt-0.11.1.tar.gz. Error message was: > file_get > _contents(): php_network_getaddresses: getaddrinfo failed: Name or service > not k > nown > -Unable to download file Passelivre.jpg. Error message was: > file_get_contents(): > php_network_getaddresses: getaddrinfo failed: Name or service not known > +Unable to download file Qlandkartegt-0.11.1.tar.gz. Error message was: > file_get > _contents(): php_network_getaddresses: getaddrinfo failed: No such host is > known > . > +Unable to download file Passelivre.jpg. Error message was: > file_get_contents(): > php_network_getaddresses: getaddrinfo failed: No such host is known. > > > FAILURES! > Tests: 39, Assertions: 98, Failures: 2. > > > As for the acceptance tests, even with TikiTestCase moved back, they > still fail. The message says something like: > > "Call to a member function set_preference() on a non-object ..." > > This is on the line $tikilib->set_preference(), so I suppose that > globals are somehow not set. Have to see why ... I'll work on that and > move the tests only when they start working again. > > Thanks for your help, talk to you later, > Marta > > > > > On Fri, Aug 7, 2009 at 10:47 AM, Rodrigo Sampaio > Primo<rod...@gm...> wrote: > > Hi Marta, > > > > The tests on lib/test should be working, although at present there is no > way > > to run them together. The tests I wrote for the Tiki Importer use one > > AllTests.php file and if you call phpunit lib/test/importer/AllTests.php > it > > should work and all tests should pass. > > > > The tests Louis-Philipe wrote for the core lib use phpunit XML to > organize > > the suite. You can change to the core tests root directory > (lib/test/core) > > and run phpunit . and this also should work. Not all of those tests are > > working, some of them will fail but Louis-Philipe told me that this was > > happening before a moved the tests. There was only one problem that was > > killing the test script that we fixed today. > > > > The acceptance tests are broken because they extend TikiTestCase and I > moved > > the file that defines this class to the new directory. So when you move > them > > to the new directory I think this is not going to be a problem anymore. I > > would like to move those tests by myself but I was never able to > > successfully run them so that is why I decided to not touch them (might > be > > another Linux vs Windows issue, not sure). > > > > After moving the acceptance tests to the new directory I think the next > > steps are: > > > > - making sure that all tests run both on Linux and Windows > > - choosing between phpunit XML and AllTests.php approach > > - create an integrated way to run all tests (using the chosen approach) > > > > Cheers, Rodrigo. > > > > On Tue, Aug 4, 2009 at 7:22 PM, Marta Stojanovic > > <mar...@gm...> wrote: > >> > >> Hi Rodrigo, > >> > >> Sorry for a late reply, I've been away from my mail. I see that the > >> tests are not working anymore (neither from lib/core/test nor from > >> lib/test). I'll have a look at it on Thu, I'm away tomorrow as well. > >> Thanks for trying to make it more user-friendly, we'll make those > >> tests work very soon (can't commit without running them, so it is high > >> on my list of priorities). > >> > >> Take care, > >> Marta > >> > >> > >> > >> On Sun, Aug 2, 2009 at 12:26 PM, Rodrigo Sampaio > >> Primo<rod...@gm...> wrote: > >> > Hi (moving the discussion to tiki-devel), > >> > > >> > Today during TikiFest Barcelona after discussing with Louis-Philipe I > >> > created on trunk the directory lib/test. The idea of this directory is > >> > to > >> > centralize all Tiki tests (both unit and acceptance tests). > >> > > >> > I have moved the tests I wrote to Tiki Importer to lib/test/importer > and > >> > the > >> > test Louis-Philipe wrote to lib/test/core. > >> > > >> > Alain and Marta, can you help me moving the acceptances tests from > >> > lib/core/test to lib/test? After this we can remove the directory > >> > lib/core/test. > >> > > >> > Thanks, Rodrigo. > >> > > >> > On Wed, Jul 15, 2009 at 9:48 AM, Desilets, Alain > >> > <Ala...@nr...> wrote: > >> >> > >> >> > Hi Alain (cc Nelson as he is my GSOC mentor and Marta as you told > me > >> >> she is also > >> >> > working with tests to Tiki), during the GSOC TikiFest I quickly > tried > >> >> to run the > >> >> > Tiki test suite but apparently it was using windows path separator > >> >> when appending > >> >> > some dirs to the include_path (only today I figured this so that is > >> >> why the tests > >> >> > I'm writing are not integrated with the rest of Tiki tests). > >> >> > >> >> Sorry about that. Our bad. > >> >> > >> >> > Today I changed it to > >> >> > use PATH_SEPARATOR constant and the tests are running ok in my > Linux > >> >> machine. It is > >> >> > likely that it will continue running on windows boxes but I don't > >> >> > have > >> >> one to test > >> >> > it. > >> >> > >> >> Good. We'll make sure to do that in the future. > >> >> > >> >> > I'm using phpunit mock objects in some of my tests but I did not > find > >> >> a way to mock > >> >> > PHP builtin functions (I'm not even sure if this is possible and if > >> >> this is a good > >> >> > idea). > >> >> > I come with this because of a specific problem. In my code I use > the > >> >> builtin > >> >> > PHP function DOMDocument::schemaValidate() for some weird reason > that > >> >> I can't > >> >> > explain this function use internet connection for something (I > found > >> >> this when > >> >> > trying to run my tests without connection to the internet and > getting > >> >> the error: > >> >> > "DOMDocument::schemaValidate(): php_network_getaddresses: > getaddrinfo > >> >> failed: Name > >> >> > or service not known"). My test suite is running sometimes very > fast > >> >> (1 second or > >> >> > less) and sometimes very slow (more than 20 seconds) and I'm almost > >> >> sure that this > >> >> > is due to the DOMDocument::schemaValidate() function connecting to > >> >> > the > >> >> internet. So > >> >> > I would like to mock this function to make the test suite faster. > >> >> > > >> >> > What do you think? > >> >> > >> >> Before you go and mock schemaValidate(), I would make damn sure that > it > >> >> is the function call that's causing the intermittent delays. For > >> >> example, print the elapsed time for each call to that method. > >> >> > >> >> If it turns out that schemaValidate() is indeed the one causing the > >> >> intermittent delays, I would try to identify the reason why it > >> >> sometimes > >> >> is slow, and sometimes is fast, and see if you can address it some > >> >> other > >> >> way. For example, it could be that schemaValidate needs a schema file > >> >> that resides somewhere on the internet. If so, might there be a way > to > >> >> look for that file locally on the disk instead? > >> >> > >> >> If you have no choice, then I guess you will have to mock it up. If > >> >> schemaValidate is a method of a standard class, then subclass it with > a > >> >> mock. If it's a function, then you will have to create a wrapper for > >> >> that function in Tiki, and make sure you're your classes always > invoke > >> >> it through that wrapper. Then at testing time, you can use a mock > >> >> version of the wrapper which returns hardcoded data instead of > invoking > >> >> the actual standard function. > >> >> > >> >> > Ps: I'm not able to find in my Skype the chat history of our > >> >> conversation during > >> >> > GSOC TikiFest. Which were the tests that you think can be moved to > >> >> lib/tests? > >> >> > >> >> The tests which are under lib/core/test/AcceptanceTests. > >> >> > >> >> Alain > >> > > >> > > >> > > >> > > ------------------------------------------------------------------------------ > >> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > >> > 30-Day > >> > trial. Simplify your report design, integration and deployment - and > >> > focus > >> > on > >> > what you do best, core application coding. Discover what's new with > >> > Crystal Reports now. http://p.sf.net/sfu/bobj-july > >> > _______________________________________________ > >> > Tikiwiki-devel mailing list > >> > Tik...@li... > >> > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > >> > > >> > > >> > >> > >> > ------------------------------------------------------------------------------ > >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > >> 30-Day > >> trial. Simplify your report design, integration and deployment - and > focus > >> on > >> what you do best, core application coding. Discover what's new with > >> Crystal Reports now. http://p.sf.net/sfu/bobj-july > >> _______________________________________________ > >> Tikiwiki-devel mailing list > >> Tik...@li... > >> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > > > > > > ------------------------------------------------------------------------------ > > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > > trial. Simplify your report design, integration and deployment - and > focus > > on > > what you do best, core application coding. Discover what's new with > > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > Tikiwiki-devel mailing list > > Tik...@li... > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > > > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Tikiwiki-devel mailing list > Tik...@li... > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > |