testbox-mockbox

Official

Create reliable TestBox mocks and spies.

AuthorColdBox
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Provide deterministic, controllable test doubles for ColdBox TestBox specs so unit tests can isolate systems under test, simulate database queries, and assert interactions without hitting real external services.

Core Features & Use Cases

  • Full, empty, and partial mocks via createMock, createEmptyMock, and prepareMock to replace collaborators and drive specific behaviors.
  • Argument-specific stubbing with $args and $results, exception simulation with $throws, query simulation with querySim, property injection with $property, and spying on real methods with $spy for behavioral verification.
  • Call logging and verification helpers ($once, $never, $times, $count, $callLog) to assert invocation counts and inspect arguments in service, DAO, and email-sending scenarios.

Quick Start

Prepare a mock for UserService that stubs save to return an object with id 1 and assert that save was called once.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: testbox-mockbox
Download link: https://github.com/ColdBox/skills/archive/main.zip#testbox-mockbox

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.