Nette Tester 2.0.0 is out

by Miloslav Hůla 11 months ago in Tester

Nette Tester 2 is finally out. I'll describe changes and new features in detail.


New Tester requires PHP in version 5.6 or newer and supports PHP 7.2. Simultaneously, support for HHVM has been dropped. There has been small opinion poll on this topic.

Changes in tests runner

Tester's default interpreter (when called without the -p option) is CLI now. It used to be CGI. You will see notice in console about it.

When you pass directory as a tester argument, it will find all *.phpt files as usual, but newly it will find all *Test.php files additionally.

The Tester used to run tests in order as they have been found. Now, it will run last time failing tests as first. For this purpose, the Tester uses temporary directory. Default is got by sys_get_temp_dir() and you can change it by explicit --temp <path> option. The --info call will help you find out currently used directory. Try to think about this new feature in relation to --stop-on-fail or --watch options. It may improve your workflow.

As mentioned in documentation, every test is run by PHP in separated process with -n option. So without php.ini file. Sometimes it is painful to tune up own php.ini file for tests. A new option -C is introduced, it causes that -n is not used and as a consequence, tests run with system-wide PHP settings.

Sometimes is good to know whether test is running by tester myTest.phpt or as an ordinary PHP script by php myTest.phpt. An environment variable will help you to recognize it:

if (getenv(Tester\Environment::RUNNER)) {
    # by Tester
} else {
    # other way

And when talking about environment variables, there is another one. When tests run in parallel, by default in 8 threads, you can be interested in a current thread number.

$threadNumber = getenv(Tester\Environment::THREAD);

Changes in testing framework

New modifiers for Assert::match() have been added. The %w% matches alphanumeric chars 0-9, a-z, A-Z and _ (underscore). The %% matches one % char.

Behavior of FileMock has been fixed, mainly in an append mode.

Another change concerns the TestCase. Now, the TestCase::tearDown() run always, even aften an error occurred in a testing method. Small BC break is that the TestCase::run() method does not accept arguments anymore. If you need to run a single testing method, use the TestCase::runTest($method, array $args = []) method.

New test file annotation @phpExtension has been added. When some of given extensions is not loaded, test will be skipped. You can use one annotation with multiple extensions, or split it to multiple annotations. For example:

 * @phpExtension pdo, pdo_pgsql
 * @phpExtension json

Completely new helper FileMutator has been added. Its purpose is to adjust source code of loaded files. The first real use case is removing final keyword from classes and class methods. Usage is simple. Call the Tester\Environment::bypassFinals() on the very top of a test file, it will setup FileMutator for you.

require 'bootstrap.php';
# Now, you can extend final classes or overload final class methods.

Changes in output formating

When other than expected exception is thrown in the Assert::exception(), its stack trace will be printed. It helps to find out, what is wrong.

If you are using Assert::match() with modifiers (%a%, %d% and so on), you will be pleasured by a new feature. In case of fail, modifiers are replaced by their matching values in output and dumps. An example will say more. Imagine test such:

$tested = "My name is Milo and I'm -65535 years old.";
Assert::match("My name is %S% and I'm %d% years old.", $tested);
# An output before the Tester 2
    Failed: 'My name is Milo and I'm -65535 years old.' should match
        ... 'My name is %S% and I'm %d% years old.'

# An output with new Tester
    Failed: 'My name is Milo and I'm -65535 years old.' should match
        ... 'My name is Milo and I'm %d% years old.'

Do you see that small difference? The %S% modifier is now replaced by a matching value and you don't need to decrypt where mismatch occurred. Very handy when matching long strings.

If you use code coverage functionality with a PHPDBG, some tests may fail due to a memory exhaustion. Coverage data collecting is a memory consuming operation. You can increase memory limits, or you can call Tester\CodeCoverage\Collector::flush(). It will write collected data into file and release occupied memory. Calling has no effect with Xdebug or when collecting is not running at all.

HTML output of code coverage has been facelifted. Check out an example.

And here we come with the biggest BC break in the Tester 2. Changes in the OutputHandler interface. Before I'll describe it, I have to make a short introduction how tests are handled internally by the Tester.

Inside the Tester, single test is represented by Test class instance. In a short, it contains test file path, test title, result code, captured standard output and so on. Check out the source code for details. These instances are passed to output handlers in the Tester 2. Refactored OutputHandler now looks as follows:

namespace Tester\Runner;

interface OutputHandler
    # Before testing, something like init phase.
    function begin();

    # When new test has been found. Called for every test before a testing starts.
    function prepare(Test $test);

    # Test achives some result.
    function finish(Test $test);

    # Called on a testing end. Not necessarily all tests have been run.
    function end();

Some other minor improvements have been done, like printing code coverage percent value into console, or dumping arrays in a short syntax.

In conclusion

The Tester's internal code went through more changes, but they are not important for end users. For example, Tester's code base now uses new Nette coding style with small true, false, null constants and use new code checker. Details can be found in commits history.

Documentation is up to date and is still on the same place as usual.

Many thanks to all contributors! Enjoy the new release!

Nette Pro / Magazine #4

by Honza Černý about a year ago in Nette

New Nette 2.4 is out

After a summer break, here comes a whole heap of news and info about what has been going on and what is in the picture. The hottest piece of news is the new version of Nette Framework 2.4. A complex overview of changes made to the framework, including all novelties related to versioning, can be found on the release webpage:…2-4-released. In short, in the future only respective packages will be versioned (such as the release described here:…4-2016-07-31). Other big changes that should be mentioned is Nette/Object replacement with traits, see David's talk from Hradec Králové:… and the fact the “guts” of Latte, a template system, have been rewritten (a video from Plzeň will be published on YouTube soon). Here is also a post bringing attention to what you need to be careful about when migrating:…nette-2-4-rc. If you're still unsure whether you should use the latest version of Nette Framework or not, why don't you read a short post from the Slevomat boys about changin to 2.4:…122388672512, there are more and more companies following the example. In case you run on 2.4 too, tweet with hashtag #nettefw.

Nette Camp

A four-day event filled with Nette and beer took place in a quaint village in Czech Paradise and judging from the reactions, it was a hit. Speaking on behalf of organisers, we have learnt yet a lot and let's hope it will be for the benefit of future events. You can expect Nette Camp 2017 again in the last two weeks of August. As a surprise we migrated to a new portal: .

Following several meetings with Tomáš Votruba, the Czech Symfony community care-taker, we put our heads together and we are starting to build a framework non specific php community. More news to be expected on twitter @pehapkari. Follow us for what's hot in the czech php world.

In a Nutshell

Nextras & Kdyby

Compatible extensions releases go hand in hand with the release of new Nette Framework version. Most packages are compatible with Nette 2.4 already, if sometimes in @dev versions for now. We are still waiting for some stable releases.


Petr Knap from Netpromotion released a simple PHP profiler with a Tracy extension:…ion/profiler

Nette and Webpack

Jirka Pudil wrote an article on how to interlink these two platforms in an easy way:…with-webpack

In Conclusion

If you have ideas how to improve our next edition, please let me know. Have I forgotten something? Make sure to email me and we will include it in the next edition. We are still looking for partners who wish to address the growing community interested in our news.

Honza Cerny

P.S.: David released a new framework version ready to support php 7.1 while I was writing my intro:…4-2016-09-30

Nette Pro / Magazine #2

by Honza Černý 2 years ago in Nette

Nette 2.4 is coming closer

At the last PoSobota meetup, David Grudl introduced the news waiting for us in the version 2.4 which should become the LTS in Nette version 2. There are big plans with Nette version 3, especially regarding PHP 7, therefore the version 2.4 should most likely be the version for all Nette 2.x projects to stick to for good, thus the prolonged support. As of today, the minimal support of each .x version is 2 years, prolonged by at least a year in the LTS version.

Nette Camp

Summer is coming! (pun intended) and the planned outing in the open is coming with it. You can pre-register at Together with Tomas Jacik, we are preparing many new things and we will try to overcome the obstacles exposed by last year’s 0th Camp. The date is 25 – 28 August 2016 and we are moving the venue to Český ráj.



Dan Kadera is actively working on Nittro, a JavaScript framework for Nette Framework. Among new components, there is: Paginator, AutoConfirm or Dropzone. Make sure to follow @nittrojs for upcoming demos.

VS Code

If you are coding in VS Code, you will surely be pleased with syntax support for Latte and NEON.…


A new version of the utility Viktor was released. The utility checks whether you have the latest version of libraries installed with composer.

Worth reading…

Martin Zlamal published an article about replacing RobotLoader with PSR-4 in a new Nette application.…der-aplikace

And not only that. He also wrote an article describing how the “magical” mapping of presenters works.…g-presenteru

To Conclude

If you desire to leave some feedback or whether you miss some important info here, please contact me.

Honza Černý (it’s like John Black)

Thanks to Rockaway

Nette Pro / Magazine #1

by Honza Černý 2 years ago in Nette

We Are Expanding

Our Czech mailing list community already counts more than 600 subscribers. It is a shame that we are not able to gauge the exact count of newcomers who decided to read this actual post. But I believe that this number is going to rise at least as fast as the Czech, local one.

Nette Framework

A new patch version of Nette Framework has just released. It brings a few novelties that may be found at…3-9-released. I cannot leave out, at least, one of them – it is now possible to turn off the Tracy by Debugger::$showBar = FALSE; The last stable versions (2.3.9, 2.2.12 and even 2.1.12) are fully compatible with PHP 7 and, as a bonus, version 2.3.9 is able to get use of PHP 7 features as argument type hints and a return type of a generated factory.

But this is not the end yet. There has also been proposed Nette 2.4 release plan; the subsequent issue of this newsletter is going to contain some more info about it.

Tracy Built Upon AJAX

David Kadera is currently working on some changes that I would like to mention. The functionality of Tracy is going to be enhanced with support for AJAX (and likely CLI also) – the first dose of code and tests are already online. You can review a working prototype at…ree/ajax-bar.

PhpStorm Plugins

The popular PhpStorm plugins have been updated – David Matějka submitted their new versions during February. Especially autocomplete feature in the NEON plugin works pretty well. David has also recoded a core of Nette Framework plugin that is no longer causing occasional deadlocks. And this is not the end – a new version of Latte plugin has also been released, which (besides of ordinary and n: macros) fully supports HTML, Emmet, JavaScript and CSS development.

These plugins are accessible through the JetBrains Plugin Repository (Neon, Nette and Latte). You might also want to support us by starring our corresponding GitHub repositories. Neon ★, Nette ★, Latte ★


More and more people are coming to our informal discussing event, so as a consequence, we are expanding to even more locations during the next month. A new Facebook page is about to be set that is going to work as a hub of organizing these events at even more places – e.g. it will be possible to involve cities as Vienna or Berlin.


You can support our team by purchasing official Nette t-shirts from a recently launched online store. Also, when you are buying a t-shirt, don't forget to order some more Nette stickers; Unfortunately, out-of-Czech delivery is not currently supported. But anyway, in case of demand of any item, you can still contact me.


A reveal of NettePro is coming soon. David Matějka has already coded a ticket support app and David Grudl is finishing a registration tool and a dashboard containing info provided to our partners. Last, my work is to hire people for a support team (Nette Support Commando – will be adjusted ;-) ).

In a Nutshell


Milan is constantly updating a new addons portal which is about to lose its beta tag soon. Test it and leave a feedback.


A lifespan of this hangover tool is certainly heading to the end. A Newer version of Nette Framework will replace this object by Trait collection. You can already see it in production at Dibi and Texy projects.

Nextras ORM 2

Nextras community has released new major version of its new popular ORM newcomer. Change list may be accessed from here.

Nette Tester & PhpStorm

Jirka is currently working on a code integration, see the online repository.

To Conclude

You have just finished reading of the first official NettePro Newsletter. If you desire to leave some feedback or whether you miss some important info here, please contact me.

Honza Černý (it’s like John Black)

Nette Pro / Magazine #0

by Honza Černý 2 years ago in Nette

We are starting something new

This article is a shortened translation of a Czech e-mail magazine. Honza started with writing some news from our community and foundation. Because we want to talk to you, no matter where you are, we have also turned this e-mail magazine into a blog post. We are planning a new article delivery in every 2–3 weeks. However, a brief delay might occur depending on a translation speed. If you'd like to help us with a content and/or corrections, contact Honza for more information. We are open for any help.


This Twitter hashtag stands for small repeated events and casual community meetings. An English equivalent, #NetteFwBeer, will also be used. These casual meetings take place every second Wednesday in a month. If you'd like to set up your own local community event, just create an event at elsewhere) and promote it on a Nette forum. We want the community to grow and this is a one of the ways how we are able to make it happen.

“Poslední sobota”

“Poslední sobota”, which stands for Last Saturday, is a bigger happening that is taking place on the last Saturday of every month. Unfortunately, it is only Czech event (so far). However, we are planning to spread the event to even more locations (there is still plenty of places to visit) to gather and keep all the local Nette comunities together. We’d also love to visit places beyond Czech borders to come up with some new amazing English talks. If you want to land a hand, don’t hesitate to contact us. Initially, we’d like to expand to Germany, Poland, Austria and Slovakia, but our door is certainly open to many other countries as well. :)

Addons portal

Milan (Felix) released a new version of a next generation addons portal. This is the place where you can find a lot of addons for your Nette applications. It’s still in beta, but we are working hard to make it as seamless as possible. As soon as all the addons are available and latest minor visual improvements are finished, we will place the new portal whereas the old one is going to serve as an example Nette application on GitHub. So, if you have any ideas or bug reports, please open an issue on GitHub or just tell us on


We are planning to launch a Nette Pro merchandise e-shop. The e-shop is comming out in late February. First offer will cover (official) t-shirts only, but some additional products may be coming soon. Any gained profits will be used to buy either new or existing equipment capable of recording our events to make them accessible to even broader audience.



New version of a Tester testing tool has been released. Milo wrote a blog post describing new features and changes involved. You can find it here:…tester-1-7-0.

FTP deployment

If you are using FTP as a software deployment tool, you’ll definitely appreciate a new version of ftp-deployment tool that has been currently released by David. You can find more about the 2.3 release, including some news, on GitHub release page at…ses/tag/v2.3.

Lean Mapper

ORM Dibi-based database layer, originally developed by Vojta (Tharos), will be taken over by Mirek (Castamir). He’s been using Lean Mapper for a long time and has a lot of new ideas and improvements to implement.

For the end

Next magazine edition will come shortly. This article is covering only a small portion of all the changes planned. Finally, as a sneak peek, we are working on a new navigation through portal. In upcoming edition, there will be information about a lot of new stuff, including changes in codebase and, of course, Nette Pro.

If you’d like to help us with further improvements, just contact Honza.