From 10e23ec44882cbf821215130601a21e515922c12 Mon Sep 17 00:00:00 2001 From: Isaac Adzah Sai Date: Wed, 20 Dec 2023 22:35:47 +0000 Subject: [PATCH] Try github actions for testing --- .github/workflows/php.yml | 36 +++++++++++++++++++++++++++++++++ me.md | 26 ++++++++++++++++++++++++ readme.md | 30 ++++++++++++++++++++++++--- src/Contracts/InitialAction.php | 8 ++++++++ src/Tests/PendingTest.php | 3 ++- src/Tests/Testing.php | 3 ++- src/Ussd.php | 9 +++++---- 7 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/php.yml create mode 100644 me.md create mode 100644 src/Contracts/InitialAction.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..ccfaa2a --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,36 @@ +name: PHP Composer + +on: + push: + branches: [ "3.x" ] + pull_request: + branches: [ "3.x" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test diff --git a/me.md b/me.md new file mode 100644 index 0000000..7de1c4f --- /dev/null +++ b/me.md @@ -0,0 +1,26 @@ +/** + * Laravel Ussd + * + * Build Ussd (Unstructured Supplementary Service Data) applications with Laravel without breaking a sweat. + * + * @package Laravel Ussd + * @version 3.0.0 + * @author Sparors + * @link https://sparors.github.io/ussd-docs/ + * + * @see https://packagist.org/packages/sparors/laravel-ussd + * @see https://travis-ci.com/sparors/laravel-ussd + * + * @license MIT + */ +# Laravel Ussd + +[![Latest Version on Packagist][ico-version]][link-packagist] +[![Total Downloads][ico-downloads]][link-downloads] +[![Build Status][ico-travis]][link-travis] + +Build Ussd (Unstructured Supplementary Service Data) applications with Laravel without breaking a sweat. + +## Installation + +You can install the package via composer: diff --git a/readme.md b/readme.md index 4fec5fe..3929d0a 100644 --- a/readme.md +++ b/readme.md @@ -234,7 +234,7 @@ namespace App\Http\Controllers; use Sparors\Ussd\Facades\Ussd; use App\Http\Ussd\States\Welcome; -use App\Http\Ussd\Configurators\Nsano' +use App\Http\Ussd\Configurators\Nsano; // Using it in a controller class UssdController extends Controller @@ -257,8 +257,32 @@ You'll find the documentation on [https://sparors.github.io/ussd-docs](https://s ### Testing -``` bash -$ vendor/bin/phpunit +You can easily test how your ussd application will respond to user input + +``` php +additional(['network' => 'MTN', 'phone_number' => '123123123']) + ->actingAs('isaac') + ->start() + ->assertSee('Welcome...') + ->assertContextHas('network', 'MTN') + ->assertContextHas('phone_number') + ->assertContextMissing('name') + ->input('1') + ->assertSee('Now see the magic...') + ->assertRecordHas('choice'); + } +} ``` ### Change log diff --git a/src/Contracts/InitialAction.php b/src/Contracts/InitialAction.php new file mode 100644 index 0000000..5170d5a --- /dev/null +++ b/src/Contracts/InitialAction.php @@ -0,0 +1,8 @@ +initialState = $initialState;