Fix: Single File Tests Break in Netbeans 11.0 / PHPUnit 8.2

TL/DR: There’s a one line patch to PHPUnit below that will kludge the kludge and get you running again.

Anyone who has worked with PHPUnit for some time knows that backwards compatibility isn’t exactly a prime consideration. Meanwhile, although Netbeans currently has very good support for PHP, you have to figure that the intersection set between the Java developers working on the project and the people who figure that PHP is anything but a toy language for building simple projects is, well… small. [We’ll just ignore the fact that Facebook, the largest application on the planet, is written in PHP].

So when Netbeans says it offers support for PHPUnit 3.4.0 or higher, it’s okay to expect the integration to be out of date. Rather surprisingly, it’s actually worked right up to PHPUnit 8.1.

But now we have 8.2. Command line parsing has been made more robust, and the extra parameter Netbeans passes in to a kludged custom test when running a single file doesn’t work anymore. [BTW I don’t blame the Netbeans developers for this kludge, it was probably the only solution that worked back in 3.4.0.]

This makes the current Netbeans approach outdated and unworkable. Like many open source projects, this means someone who cares has to go in and do some significant re-work. Don’t hold your breath. I’d give it a go but my Java foo is about 20 years old now. I probably don’t know enough anymore to even be dangerous. I think I know a good architectural approach but attempting to implement it would be a recipe for failure.

So what to do? Patch PHPUnit! This is a pain since the patch will have to be reapplied every time PHPUnit is updated, which is frequently. But at least it works.

So here’s the kludge: in the file TextUI/Command.php in the handleArguments array, just change the line that reads

if (isset($this->options[1][1])) {

to

if (isset($this->options[1][1]) && substr($this->options[1][1], 0, 6) != '--run=') {

This ignores the Netbeans-generated argument and everything works as before. Not pretty but it works.

For more information (and a possible fix), follow the Netbeans Issue.

Creative Downloads: Everything Is Not Free, at Least Not Yet

A few minutes ago I didn’t know Sara Madison existed. Until an author friend shared her brilliant post “Dear Broke Reader: Your Sense of Entitlement is Killing Me” on Facebook.

Readers of this blog will know that I’m a huge fan of open source. Be it software, designs, engineering, etc. There’s a huge body of work that I believe benefits from the open source movement. That belief is predicated around freedom. I strongly believe that people who use products should have the ability to control their destiny after they acquire a product, and the best way to do that is to give them the tools to recreate and modify the product.

But that doesn’t mean everything should be free. While it’s true that I have contributed to collaborative open source projects that give the code away, it is not an entirely altruistic endeavour, for at the same time I’ve taken advantage of similar efforts by hundreds of others to build things that I never could have built alone. The key thing here is that these projects are collaborative works where all the participants in a community benefit.

Individual creative works are another thing entirely. There’s no similar multiplier that gives a creator back a multiple of what they’ve contributed. Someone who illegally downloads a book by a small author isn’t gaining any freedom, they’re just getting a product for free. If you download one of my Creative Commons licensed low resolution photographs and use it to print a crappy large format print, you deserve to waste your money. Book authors don’t enjoy that ability to constrain the clarity of digital versions of their work.

At some point, as individual labour stops being the way most of us add value to the economy, we’ll have to transition to some form of guaranteed minimum income scheme. At that point, there might be a rationalization that goes along the line of “this author is already receiving enough to get by, so they’re getting enough”. While I can’t say I agree with that position, at least someone who is passionate about creating has the knowledge that they won’t starve to death in the process. But neither will they live comfortably, nor will they receive the value that others derive from reading their work. A survivable system still isn’t a sustainable system. But this is futurism. We’re not there yet, and until then, taking advantage of someone who needs the money to keep doing what they’re doing is outright theft.

The Blog is Ported (again). Hello WordPress.

Welcome to the third major iteration of It’s Fixed in the Next Release. From Blogger (yuck) to Serendipity (which truly deserves more attention than it gets) to WordPress (market share wins, even in the open source world) here we are.

Speaking of open source, what you see here is only possible because of the FOSS (Free Open Source Software) model. Not only is the core of WordPress completely open, most of the themes, plugins, and tools are as well.

Independent of the cost, FOSS made this blog because the theme is a hybrid. The base theme is the free version of “Blogolife”. I’ve made some changes to it, both in terms of some invisible code rework, and by hacking in the tag display from “AskIt”, a commercial template I purchased for a project that died. At first I thought AskIt was going to do the trick, but in the end I just didn’t like the main page layout. Blogolife had the clean traditional blog feel but the display of tags and categories wasn’t all that great (I haven’t done anything to the categories yet).

I also removed all of Blogolife’s admin links and promotions for the “PRO” version. Needless to say I wasn’t likely to be buying that anyway.

It’s interesting hacking on WordPress code, and it’s a classic comparison between simplicity and power. I think it’s possible to keep most of the WordPress API in your head, and its possible to be a true expert on it in a year or so. Meanwhile, I’ve been working with Joomla for almost six years now, and it seems I keep on discovering new tricks, not including the outside-the-core stuff like template frameworks and the like. So there’s a freedom in WordPress that makes it possible to hack bits of two themes together in a few days and get something that works. But at the same time I feel like I’m working in a small shop with hand tools. By comparison Joomla feels like a manufacturing line full of robots — configure each one to do a job then watch the whole facility in action.

Each environment has its place. It’s actually more personally satisfying to feel you’ve built something by hand. WordPress certainly rocks the blogging / simple site space, but it has its limitations. Over in the Joomla development world we wrestle with issues like how to make it so those “robots” of ours plug into each other most effectively and with a minimum of code duplication. While we’re making it easier to plug things together I think we’d also be wise to keep an eye on offering freedom to site builders who need to produce a custom solution but only know the basics of PHP development. We never want to be in the position where someone says “Joomla is a great platform but you need a team of developers to build and run a site.”

After all, market share wins, even in the open source world.

So Long, Serendipity, and Thanks for All the Posts

To say this blog has suffered from neglect is to make a rather large understatement. It turns out that converting a passing thought into a coherent post takes too many words and too much time. Or maybe finishing a post just doesn’t generate enough endorphin. Whatever the reason, It’s Fixed in the Next Release underwhelmed my expectations, and then Twitter really made a mess of it. (more…)

Simplifying Joomla Template Layouts

Since the early days of Joomla 1.5, component layouts have bothered me. First there’s the problematic nomenclature (which I’m probably using incorrectly). Layouts are component-specific snippets of HTML and PHP logic that generate the actual code (usually HTML) that goes to the target device. A template can override the default layout, which is just one of the many powerful features that give Joomla sites so much flexibility.

My biggest problem with layouts is that they typically embed too much logic. Why should a layout be determining what to do if a category description isn’t present? Worse yet, why does it have to check access to see if an article body should be displayed or not? Surely the actual view should be responsible for this sort of thing, and the layout should be strictly concerned with how to present the information that’s available.

The other problem is that layouts are ugly beasts. Most layouts need to flip between HTML and PHP dozens of times, just to do the most simple thing.

I’m not exactly a patient person. Maintaining the existing layout code in the Joomla core components is bothersome enough, but recently I started doing extensive work on a third party component, adding my own view in the process. That’s when that familiar snapping sound resonated in my head. Always a sucker for diversions, I decided to follow the tangent and see if I could improve Joomla layouts.

It took about triple the expected effort, largely because the initial results were pretty exciting, and I decided to do more than a hack job. The result is JTML, and the results are described in the white paper Simplifying Joomla Template Layouts.

Every once in a while, the idea of creating a simple language for creating Joomla extensions comes up, but that is a very big job indeed, and there are many, many other things to do in the project. So it remains a bit of a dream. I’m hoping JTML is one small step in that direction.