Giter Site home page Giter Site logo

example-phpunit's Introduction

An example project that uses php-actions/phpunit

This is a trivial project that holds only simple example functionality: a greeter that can greet you by name.

Check out the Actions tab in the Github repository to see the past actions workflows and their outputs.

There are unit tests stored within the test directory, along with a phpunit.xml.

The file at .github/workflows/ci.yml shows how to use php-actions/phpunit - take note of the uses: php-actions/phpunit@v9 line.

Versions of PHPUnit and all options are available to configure. Please see the php-actions/phpunit documentation for more information!

Functionality

There are two classes in this example project; Greeter and EnvGreeter, in the src/ directory, which are tested in the test/ directory.

The Greeter has a function, greet() which takes an optional name. Without providing a name, the Greeter will return "Hello!", otherwise it will include the provided name, like "Hello, Example!".

The EnvGreeter extends Greeter and provides a new function, greetFromEnv(), which takes the name of an environment variable to load the name from.

The GitHub Action tests are executed in the ci.yml file where the TEST_NAME environment variable is declared, along with any other PHPUnit configuration.

Click the Actions tab at the top of this repository to view the latest test runs.


If you found this repository helpful, please consider sponsoring the developer.

example-phpunit's People

Contributors

g105b avatar maxoralbay 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.