Simple, functional programming style test framework

0.6.0 2015-08-31 09:07 UTC


Travis CI

A simple, functional programming inspired, test framework.

Ouroboros, the greek dragon eating its own tail

This project was started as a reaction to this issue and was initially a gist. It's currently not meant to be used in production, but there's nobody stopping you if you want to.


Installing it is easy, just require turanct/omikron as a development dependency in your composer.json file, and configure a bin-dir. The omikron executable will be available in your bin directory when you've run composer install.

    "require-dev": {
        "turanct/omikron": "dev-master"
    "config": {
        "bin-dir": "bin"

Omikron has a concept of topics, topics are distinct parts of your code under test. These topics have different features, and to describe those features, there are assertions.

<?php return

        it("adds two numbers", function() { return
            expect(1 + 1, toBe(3)); // Will return false => failing test
        it("adds three numbers", function() { return
            expect(1 + 1 + 1, toBe(3));
        it("subtracts two numbers", function() { return
            expect(3 - 2, toBe(1));

This is an example of a topic. It's in a file named topics/topic-calculus.php. Every topic file must have a name starting with topic-. You can split topics over multiple files if you want to. The topic calculus has two features, addition and subtraction, and both of those features have some assertions.

To run the tests for this topic, we'll just run bin/omikron topics (as topics is the directory with my topics). The output will be something like this:

$ bin/omikron topics
topics: 1
features: 2
assertions: 3

FAILED: calculus: addition adds two numbers
Expected 2 to be 3


Omikron has unit tests, located in the tests directory. These tests are written using Omikron itself, so you can just run the Omikron executable on the tests dir!

$ bin/omikron tests


Feel free to fork and send pull requests!