vehikl/laravel-twilio-programmable-voice-test-rig

A laravel library for testing twilio programmable voice twiml flows

v0.0.1-rc.0 2023-11-03 18:27 UTC

This package is auto-updated.

Last update: 2024-11-05 04:52:23 UTC


README

Test your programmable voice twiml call flows, start to finish. Behind the scenes, uses PHPUnit static assertions, and not tested with Pest.

You need this library if you:

  • ☎️ Use twilio's programmable voice for handling phone calls
  • 📫 Have multiple endpoints to handle the flow of a call
  • 🔀 Multiple paths for the flow of a call

Quick-Start

<?php

// ...

use Vehikl\LaravelTwilioProgrammableVoiceTestRig\ProgrammableVoiceRig;

// ...

/** @test */
public function itDoesABasicFlow(): void
{
    // ...
}

Setting up your tests

Voice Calls

SMS Messaging

API

Assertions

  • assertTwimlEquals(twml, ...replacements) (works like sprintf)
  • assertTwimlContains(twml, ...replacements) (works like sprintf)
  • assertTwimlOrder([tag1Name, tag2Name])
  • assertRedirect(uri, method)
  • assertSay(textFromASayTag)
  • assertPlay(file)
  • assertDial(phoneNumber)
  • assertPause(numberOfSeconds)
  • assertStream(websocketUrl)
  • assertRecord(attributes)
  • assertGather(attributes, children?)
  • assertCallStatus(status)
  • assertTwilioHit(uri, method = 'POST', byTwimlTag = null)
  • assertCallEnded()
  • assertRejected(reason)

Contributors

  • Ahmed
  • Alex
  • Brad
  • Eric
  • Hunter
  • Ian
  • John I
  • John M
  • Jeff C
  • Justin S
  • Ruta