gregdmat/laravel-test-utilities

This package is abandoned and no longer maintained. No replacement package was suggested.

v0.3-beta 2020-01-23 20:59 UTC

This package is auto-updated.

Last update: 2021-07-21 21:34:44 UTC


README

composer require gregdmat/laravel-test-utilities

php artisan ltu:intall

Assert Structure and Value

Data Cases

This feature provides several scenarios for a data type.
  • Modify dataCases config to remove some data case.

  • Types of data available.

    • String
    • Integer
  • Basic usage:

$teste = new DataCases();
        
$teste->get([
    'attribute' => 'type',
    'name' => 'string'
]);
  • Avaible methods

    • get: return an array of cases
      $teste->get([
        'attribute' => 'type',
        'name' => 'string'
      ]);  
    
      $teste->make(
        [
          'attribute' => 'type',
          'name' => 'string'
        ],
        Model::class
      );  
    
      $teste->create(
        [
          'attribute' => 'type',
          'name' => 'string'
        ],
        Model::class
      );  
    
  • Options

    When instantiating the DataCases class, it is possible to pass an array of options to the constructor.

$teste = new DataCases([
    'integer' => [
        'except' => ['negative', 'positive'],
        'positive.min' => 1,
        'positive.max' => 3,
    ]
]);
  • Avaible options
   - except (array of name cases);
   - small.size;
   - normal.size;
   - long.size;
   - negative.min;
   - negative.max;
   - positive.min
   - positive.max
  • Avaible cases (see in the config file).