Skip to content

Nucleify/nuc_tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

  nuc_tests

Core testing infrastructure module for Pest PHP tests.

Structure

nuc_tests/tests/
├── functions/
│   ├── apiTest.php
│   ├── apiTestArray.php
│   ├── expectLogMessage.php
│   └── getModelByEntity.php
├── testcase/
│   ├── CreatesApplication.php
│   ├── CreatesUsers.php
│   └── ResolvesSqlite.php
├── Functions.php
├── TestCase.php
├── Expectations.php
├── Groups.php
├── Uses.php
└── Pest.php

Usage

All utilities are loaded via tests/Pest.php.

apiTest

test('example', 
    apiTest(
        'PUT',
        'contacts.update',
        422,
        $data,
        $structure,
        $fragment
    )
);

apiTestArray

apiTestArray([
    'user_id > empty' => [
        'method' => 'POST',
        'route' => 'contacts.store',
        'data' => ['user_id' => ''],
        'structure' => ['errors' => ['user_id']],
        'fragment' => ['errors' => ['user_id' => ['...']]],
    ],
    'put > index api' => [
        'method' => 'PUT',
        'route' => 'contacts.index',
        'status' => 405,
        'id' => 1,
        'json' => false,  // uses put() instead of putJson()
    ],
    'destroy api' => [
        'method' => 'DELETE',
        'route' => 'contacts.destroy',
        'status' => 401,
        'id' => 1,
    ],
]);

    Contributors


About

Module that contains testing infrastructure, utilities and helpers for Nucleify's tests.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages