GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codeigniter4projects/module-tests: DEPRECATED PHPUnit testing scaffold for CodeIgniter 4 modules

This repository was archived by the owner on May 18, 2024. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

36 Commits
36 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
examples
examples
 
 
src
src
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

DEPRECATED

Note: This repo is deprecated as of the official release of CodeIgniter 4. Functionality, examples, and relevant docs have been merged into the main repo. See (for example):

  • https://github.com/codeigniter4/CodeIgniter4/tree/develop/admin/module/tests

Existing modules should upgrade by merging the files from admin/module/

ModuleTests

PHPUnit testing scaffold for CodeIgniter 4 modules

Overview

Not a module itself but a testing scaffold for CodeIgniter 4 modules, ModuleTests makes it easy to setup PHPUnit tests in your modules.

To read more on Unit Testing in CodeIgniter 4 visit the User Guide.

Installation

Clone or download this repo and place src/tests and src/phpunit.xml.dist in your project root. Add the following lines to composer.json:

	"repositories": [
		{
			"type": "vcs",
			"url": "https://github.com/codeigniter4/CodeIgniter4"
		}
	],
	"minimum-stability": "dev",
	"require-dev": {
		"phpunit/phpunit" : "^7.0",
		"mockery/mockery": "^1.0",
		"codeigniter4/codeigniter4": "dev-develop"
	},
	"autoload-dev": {
		"psr-4": {
			"ModuleTests\\Support\\": "tests/_support"
		}
	},
	"scripts": {
		"test": "phpunit",
		"post-update-cmd": [
			"composer dump-autoload"
		]
	}

If you are using version tracking you should exclude test results by adding this to .gitignore:

vendor/
build/
phpunit*.xml
phpunit
composer.lock

Examples of composer.json and .gitignore are located in the examples/ folder if you need a starting point.

Paths

A number of framework and testing path are defined as constants during the bootstrap process. These default to the assumed locations if you have a standard directory structure. If you move directories around you will need to review these paths and set them appropriately.

  • APPPATH: $paths->appDirectory
  • ROOTPATH: APPPATH . '../'
  • FCPATH: ROOTPATH . 'public/'
  • WRITEPATH: $paths->writableDirectory
  • SYSTEMPATH: $paths->systemDirectory
  • CIPATH: SYSTEMPATH . '../
  • SUPPORTPATH: CIPATH . 'tests/_support/
  • PROJECTSUPPORTPATH: bootstrap.php directory
  • TESTPATH: PROJECTSUPPORTPATH . '../

Updating

As this repo is updated with bugfixes and improvements you will want to update your modules that use it. Because files need to be copied in place manually you will have to handle updates manually by cloning or downloading this repo and merging changed files into your project. "Watch" this repo to be notified of new releases and changes.

Creating Tests

See the docs on Creating Tests.

Running Tests

From your package root run composer install (or composer upgrade) to install all the required support packages, then run composer test to initiate the tests. Test results and code coverage will be written to standard output and formatted log versions will go in build/logs/.

Code Coverage

See the docs on Code Coverage.

Project Testing

ModuleTests is designed to be added to your modular library which will be included into other CodeIgniter 4 projects. If you are looking for a testing scaffold for applications built using CodeIgniter 4 as their core framework, check out Codeigniter4Projects/ProjectTests.

About

DEPRECATED PHPUnit testing scaffold for CodeIgniter 4 modules

Resources

Readme
MIT license
Activity
Custom properties

Stars

6 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.