2017 © Pedro Peláez
 

typo3-cms-extension tea

TYPO3 example extension for unit testing and best practices

image

oliverklee/tea

TYPO3 example extension for unit testing and best practices

  • Saturday, June 23, 2018
  • by oliverklee
  • Repository
  • 7 Watchers
  • 19 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 13 Versions
  • 83 % Grown

The README.md

Tea example

This repository has moved to the TYPO3 Trainer Network.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This TYPO3 extension is an example for writing unit and functional tests for Extbase/Fluid-based extensions for TYPO3 CMS using PHPUnit., (*2)

It also is an example for best practices for extbase/fluid., (*3)

For information on the different ways to execute the tests, please have a look at the handout to my workshops on test-driven development (TDD)., (*4)

Running the unit tests from the command line

.Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/UnitTests.xml Tests/Unit/

Running the tests in PhpStorm

General PHPUnit setup

composer require typo3/cms ^9.5
composer install
git checkout HEAD -- composer.json

File > Settings > Languages & Frameworks > PHP > Test Frameworks, (*5)

  • (*) Use Composer autoloader
  • Path to script: select .Build/vendor/autoload.php in your project folder

In the Run configurations, edit the PHPUnit configuration and use these settings so this configuration can serve as a template:, (*6)

  • Directory: use the Tests/Unit directory in your project
  • [x] Use alternative configuration file
  • use .Build/vendor/nimut/testing-framework/res/Configuration/UnitTests.xml in your project folder
  • Add the following environment variables:
    • typo3DatabaseUsername
    • typo3DatabasePassword
    • typo3DatabaseHost
    • typo3DatabaseName

Unit tests configuration

In the Run configurations, copy the PHPUnit configuration and use these settings:, (*7)

  • Directory: use the Tests/Unit directory in your project

Functional tests configuration

In the Run configurations, copy the PHPUnit configuration and use these settings:, (*8)

  • Directory: use the Tests/Functional directory in your project
  • [x] Use alternative configuration file
  • use .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml

Running the acceptance tests

On the command line

  1. make sure you have Chrome installed on your machine
  2. composer update codeception/codeception (just in case)
  3. download the latest version of ChromeDriver
  4. unzip it
  5. chromedriver --url-base=wd/hub
  6. .Build/vendor/bin/codecept run (in another terminal)

In PhpStorm

  1. make sure the "Codeception Framework" plugin is activated
  2. right-click on Tests/Acceptance/StarterCest.php
  3. Run 'Acceptance (Codeception)'

Creating new extensions with automated tests

For creating new extensions, I recommend taking Helmut Hummel's extension skeleton as a starting point., (*9)

About me (Oliver Klee)

I am the maintainer of the PHPUnit TYPO3 extension, which is available in the TYPO3 extension repository (TER)., (*10)

You can book me for workshops at your company., (*11)

I also frequently give workshops at the TYPO3 Developer Days., (*12)

More Documentation

Other example projects

  • Selenium demo for using Selenium with PHPUnit
  • Anagram finder is the finished result of a code kata for TDD
  • Coffee example is my starting point for demonstrating TDD with TYPO3 CMS
  • TDD Seed for starting PHPUnit projects with Composer (without TYPO3 CMS)

The Versions

31/05 2018
31/05 2018

dev-task/remove-suite

dev-task/remove-suite https://github.com/oliverklee/tdd-reader

TYPO3 example extension for unit testing and best practices

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3 example best practices

27/01 2018

dev-task/ts-lint

dev-task/ts-lint https://github.com/oliverklee/tdd-reader

TYPO3 example extension for unit testing and best practices

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3 example best practices

27/01 2018

dev-cleanup/composer

dev-cleanup/composer https://github.com/oliverklee/tdd-reader

TYPO3 example extension for unit testing and best practices

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3 example best practices

27/01 2018

dev-task/directories

dev-task/directories https://github.com/oliverklee/tdd-reader

TYPO3 example extension for unit testing and best practices

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3 example best practices

23/12 2017

dev-rewrite

dev-rewrite https://github.com/oliverklee/tea

TYPO3 example extension for unit testing and best practices.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3 best practices

09/12 2017

dev-legacy

dev-legacy https://www.oliverklee.de

This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3

09/09 2017

dev-poc/sql-table-creation-failed

dev-poc/sql-table-creation-failed https://www.oliverklee.de

This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3

08/09 2017

dev-task/typo3-8.7

dev-task/typo3-8.7 https://www.oliverklee.de

This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3

05/05 2017

1.0.0

1.0.0.0 https://www.oliverklee.de

This extension serves as an example on how to unit-test different data types and relation types in TYPO3 extensions.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

tdd phpunit extension unit testing typo3