Skip to content

Simple test for Slim4 with various PSR-7 implementations (using Travis-CI)

License

Notifications You must be signed in to change notification settings

adriansuter/Slim4-CI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slim4-CI

This repository contains a small Slim4 application that initially does not define a specific PSR-7 implementation. It uses Continuous Integration (Travis-CI) to build and check the application against the four PSR-7 implementations supported by default by the slim framework.

Status

# PSR-7 Implementation Status
1 Slim PSR-7 Slim
2 Nyholm Nyholm
3 Guzzle Guzzle
4 Laminas Laminas
5 Zend (deprecated) Zend

Note: Travis-CI is configured to be triggered automatically at least every 24 hours.

Status using the development branch of Slim (4.x)

The following status used the development branch of Slim (4.x) to test against.

# PSR-7 Implementation Status
6 Slim PSR-7 Slim
7 Nyholm Nyholm
8 Guzzle Guzzle
9 Laminas Laminas
10 Zend (deprecated) Zend

Note: Travis-CI is configured to be triggered automatically at least every 24 hours.

Explanation

When triggered, Travis-CI creates four different virtual machines. Each installs an Apache web server and this application. The web server is configured such that http://localhost/ points to the subdirectory public. Then each virtual machine would require via composer a different PSR-7 implementation.

Eventually the PHPUnit test is launched which would use the Guzzle HTTP Client to make http requests and validate the responses.

Files

Web Application

  • public/.htaccess This file contains the server override settings.
  • public/index.php This is the entry point on the server.
  • composer.json This is the composer file.

Travis-CI

  • build/travis-ci-apache.conf The apache configuration.
  • .travis.yml The travis configuration.

Tests

  • tests/bootstrap.php The tests bootstrap.
  • tests/*Test.php The PHPUnit test classes.

Development

Help in form of issues or pull requests would be very much welcomed.

  • Clone your fork of this repository.
  • Create a new branch for every patch, feature or improvement.
  • Install the required libraries.
    $ composer install
  • Decide which PSR-7 implementation you would like to use during development and install it using composer. Note that this would modify composer.json and therefore you must make sure that you do not commit those changes.
    • Slim
      $ composer require slim/psr7
    • Nyholm
      $ composer require nyholm/psr7 nyholm/psr7-server
    • Guzzle
      $ composer require guzzlehttp/psr7 http-interop/http-factory-guzzle
    • Laminas
      $ composer require laminas/laminas-diactoros
    • Zend (Deprecated)
      $ composer require zendframework/zend-diactoros
  • Install a web server, make sure that localhost points to the public/ subdirectory and start the web server.
  • Run the tests
    $ vendor/bin/phpunit

By default you will get 1 skipped test. That test works only, if the environment variable PSR7 is set to either Slim, Nyholm, Guzzle or Zend.

About

Simple test for Slim4 with various PSR-7 implementations (using Travis-CI)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages