Git Product home page Git Product logo

reference's Introduction

XP Runners

Build Status on TravisCI BSD License

This is the reference implementation of XP RFC #0303: Subcommands supporting Windows, Linux and Mac OS X.

Getting started

$ curl -sSL https://bintray.com/artifact/download/xp-runners/generic/setup-7.1.2.sh | sh
# ...

$ composer global require xp-framework/core
# ...

$ xp version
XP 7.0.2 { PHP 7.0.3 & ZE 3.0.0 } @ Windows NT SLATE 10.0 build 10586 (Windows 10) i586
Copyright (c) 2001-2016 the XP group
FileSystemCL<$APPDATA/Composer/vendor/xp-framework/core/src/main/php>
FileSystemCL<$APPDATA/Composer/vendor/xp-framework/core/src/test/php>
FileSystemCL<$APPDATA/Composer/vendor/xp-framework/core/src/main/resources>
FileSystemCL<$APPDATA/Composer/vendor/xp-framework/core/src/test/resources>
FileSystemCL<.>

Commands

The following commands are builtin:

  • version - Displays version and exits - also -v
  • eval {code} - Evaluates code - also -e {code}
  • write {code} - Evaluates code, writes result to Console - also -w {code}
  • dump {code} - Evaluates code, var_dump()s result - also -d {code}
  • help [{command}] - Displays help - also -?
  • run {class} - Runs a class, class file or xar
  • ar {operation} [{sources}] - Works with XAR archives

If no command line arguments are given, the help command is run. If command line arguments are given, but no command is passed, the command defaults to run.

Plugin architecture

Libraries may provide commands by adding a vendor binary to their composer.json named xp.{vendor}.{name}[.{command}] - for the test command, the entry is:

{
    "bin": ["bin/xp.xp-framework.unittest.test"]
}

The xp.{module}.{ucfirst(command)}Runner class serves as the entry point (if the command name is omitted, it will simply be xp.{module}.Runner).

By installing the package globally, it becomes available in any directory.

$ composer global require xp-framework/unittest
# ...

$ xp test -e '$this->assertTrue(true)'
[.]

♥: 1/1 run (0 skipped), 1 succeeded, 0 failed
Memory used: 1265.94 kB (1416.26 kB peak)
Time taken: 0.000 seconds

XP Runners know about Composer's filesystem locations and its dependency management. Thus, the above is the short form of ./xp.exe -m /path/to/unittest [-m /path/to/dependencies/of/unittest ...] xp.unittest.Runner ...

Execution

There are three execution models:

  1. Run once, exit (this is the default)
  2. Watch a directory, spawn process every time a change occurs (via -watch {directory})
  3. Start the process, keep it running until exits with exitcode 0 or the user presses enter (via -supervise)

The second model is useful e.g. to implement continuous unittest running, see here.

More features

Less configuration:

  • The timezone is automatically mapped from Windows and need no longer be set via date.timezone
  • If no use setting is defined, a globally or locally composer-installed framework will be used

Better Windows integration:

  • ANSI color escape sequences are also supported when running in Windows Console

reference's People

Contributors

thekid avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.