2017 © Pedro PelĆ”ez
 

project tense

Easy testing against multiple versions of ProcessWire CMF

image

uiii/tense

Easy testing against multiple versions of ProcessWire CMF

  • Sunday, April 23, 2017
  • by uiii
  • Repository
  • 2 Watchers
  • 5 Stars
  • 22 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 3 Versions
  • 83 % Grown

The README.md

Tense

Packagist travis-linux travis-osx AppVeyor, (*1)

Tense (Test ENvironment Setup & Execution) is a command-line tool to easily run tests agains multiple versions of ProcessWire CMF., (*2)

Are you building a module, or a template and you need to make sure it works in all supported ProcessWire versions? Then Tense is exactly what you need. Write the tests in any testing framework, tell Tense which ProcessWire versions you are interested in and it will do the rest for you., (*3)

See example or see usage in a real project., (*4)

video, (*5)

Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Configuration
  5. Troubleshooting

Requirements

  • PHP 5.6 or higher
  • Composer (https://getcomposer.org)
  • Git (https://git-scm.com)
  • MySQL or MariaDB 5.0.15 or higher

php.ini

php.ini used by php cli command must have enabled these extensions:, (*6)

  • curl
  • gd2
  • mbstring
  • mysqli
  • openssl
  • pdo_mysql

Installation

Don't forget to setup all requirements first., (*7)

Install globally:, (*8)

composer global require uiii/tense

or install as a project dependency:, (*9)

cd <your-project>
composer require --dev uiii/tense

Usage

Go to your project's root directory., (*10)

  1. create config file tense.yml:, (*11)

    tense init
    
  2. run tests:, (*12)

    tense run
    

if you've installed Tense locally as project's dependecy, use vendor/bin/tense instead of tense, (*13)

Configuration

Tense uses YAML configuration files. There are two types of config files:, (*14)

  • project (tense.yml): It should contain options directly related to the project's testing. This config is intended to be shared (VCS, ...).
  • local (tense.local.yml): It should contain options related to the machine's environment setup (database connection, ...), overwrites options from project's config. This is not intended to be shared.

The project's config can be created either manually or interactively by running the command:, (*15)

tense init

The local config is automatically initialized on each tense run when missing., (*16)

tmpDir

optional, config: project, local, (*17)

Path to a directory where files needed for testing (e.g ProcessWire installation, ...) are stored., (*18)

Path is relative to the config file's parent directory., (*19)

Default is .tense, (*20)

db

required, config: local, (*21)

Database connection parameters., (*22)

They are used to create the database for ProcessWire installation, so the user must have the privileges to create a database., (*23)

db.name is a name of the database., (*24)

Example:, (*25)

db:
    host: localhost
    port: 3306
    user: root
    pass: ""
    name: tense

testTags

required, config: project, (*26)

List of ProcessWire tags/versions used for testing., (*27)

It doesn't have to be exact version number. For each tag/version will be found latest matching existing tag (e.g. 3.0 -> 3.0.42)., (*28)

Versions are tested in the specified order., (*29)

Minimal supported version is 2.5., (*30)

Version 2.8 is not currently supported., (*31)

Example:, (*32)

testTags:
    - "2.5"
    - "2.6"
    - "2.7.1"
    - "3.0"

copySources

optional, config: project, (*33)

Copy source files into ProcessWire's' installation before testing., (*34)

It is a list of objects with destination and source properties., (*35)

Destination paths are relative to ProcessWire's installation root., (*36)

Source paths are relative to the config file's parent directory., (*37)

Sources can either be a single string or an array of strings. If the source is a string, file to file copy is used. If the source is an array of strings, the destination is considered to be a directory where all sources are copied into., (*38)

If source item is a directory, it will be copied recursively., (*39)

Example:, (*40)

copySources:
    - destination: "site/templates/HomeTemplate.php"
    source: "src/templates/home.php"

    - destination: "site/modules/Module"
    source:
        - "Libs"
        - "Module.module"

Consider tense.yml is in project's root and <project-root>/Libs is a directory. In this example these files will be copied: - <project-root>/templates/home.php to <pw-path>/site/templates/HomeTemplate.php - <project-root>/Libs/* to <pw-path>/site/modules/Module/Libs - <project-root>/Module.module to <pw-path>/site/modules/Module/Module.module, (*41)

beforeCmd

optional, config: project, local, (*42)

Command to execute before a test suite, but after a PW instance is installed and sources are copied., (*43)

This is just a single command, if you need to run multiple commands, put them into an external script., (*44)

Remember, the command should be platform independent, so using .sh or .bat files are not recommended. Best option is to use PHP as you can see in the example, but you can use any other platform independent scripting language., (*45)

Path to the ProcessWire installation will be in PW_PATH environment variable., (*46)

Example:, (*47)

beforeCmd: "composer install"

testCmd

required, config: project, (*48)

Command to execute a test suite., (*49)

Path to the ProcessWire installation will be in PW_PATH environment variable., (*50)

Example:, (*51)

testCmd: "vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Test.php"

pause

optional, config: local, (*52)

After each test suite against a ProcessWire instance but before a clean up test runner can pause and ask the user what to do., (*53)

This is useful e.g. to examine the installed ProcessWire instance., (*54)

Possible values are: - never - never pause (default) - onFailure - pause after failed test suite - always - always pause after a test suite, (*55)

Troubleshooting

cURL error: SSL certificate problem: unable to get local issuer certificate

If you got this error, you haven't properly configured PHP's curl extension. You can solve this e.g. by, (*56)

  1. download the https://curl.haxx.se/ca/cacert.pem file
  2. place it somewhere, e.g. in PHP's installation directory
  3. edit php.ini file and set curl.cainfo = <aboslute-path-to-cacert-file>

The Versions

23/04 2017

dev-master

9999999-dev

Easy testing against multiple versions of ProcessWire CMF

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richard Jedlička

testing processwire

18/04 2017

1.0.0

1.0.0.0

Easy testing against multiple versions of ProcessWire CMF

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richard Jedlička

testing processwire

03/04 2017

dev-ci

dev-ci

Easy testing against multiple versions of ProcessWire CMF

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richard Jedlička

testing processwire