Hi someone said "show me the code" so I'm diving in. I'm trying to
make parserTests work without the database (without installing
anything). I'm basically just going through the code running it,
fixing and error, then running until the next error.
Now I'm brand new to MediaWiki but I've done a lot of programming in
lots of languages. Including a bit of PHP. Seems to me like there's
an awful lot of global functions which is a bit worrying. Maybe this
is just the normal way to do things in PHP but it seems a bit
worrying to me because it could mean spaghetti code. Umm...
documentation isn't great but I've seen worse (like Mozilla).
But.. the biggest thing seems to be that the database kind of
permeates the whole code... I can see why parserTests' author wrote
separating it from the database as a @todo... and it's a bit tricky.
I'm trying to do that now, writing fake classes and stuff in there.
We'll see if it works out. A good long-term project might be to
refactor so that the database is well isolated from the rest of the
code. So that, for example, you could rip out the database and insert
something else, or like for parserTests, run some parts of the code
without a database at all. That's especially useful for unit tests :-)
(For example I tried to include "commandLine.inc" and it wouldn't go
because there's no database. I made a "commandLineSimple.inc" and
ripped out all the database code.)
I've hit a point now where the Parser access User functions. With a
command line test there's not going to be a user, so I could either
fake one, or I could temporarily modify the parser.
It seems like this might be a good place to insert an intermediate
parsing format (something between the article{wikitext, ...} and the
final HTML.
--simon
--
http://simonwoodside.com