Skip to content

Releases: RonasIT/laravel-helpers

LaravelNova Testing helpers

05 Nov 05:21
5bf2992
Compare
Choose a tag to compare
Pre-release

What's Changed

New Contributors

Full Changelog: 3.0.0-beta...3.0.1-beta

Upgrade dependencies update

22 Aug 13:21
b967de5
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.7...3.0.0-beta

Versioning release

03 Jun 07:38
466cfcc
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.6...2.7

Mock update

18 Mar 08:27
298301d
Compare
Choose a tag to compare

Breaking changes

  • RonasIT\Support\Traits\MockClassTrait renamed to RonasIT\Support\Traits\MockTrait
  • All mails testing logic moved to the new RonasIT\Support\Traits\MailsMockTrait
  • Mails classes should extends RonasIT\Support\Mail

Deprecated

  • SearchTrait:
  1. filterMoreThan
  2. filterLessThan
  3. filterMoreOrEqualThan
  4. filterLessOrEqualThan

All Changes

Full Changelog: 2.5...2.6

DB State testing release

19 Dec 08:12
259760f
Compare
Choose a tag to compare

Features

  1. New predefined filters
app(UserService::class)->search(['age_lte' => 16]); //return users with `age` field less or equals 16
app(UserService::class)->search(['age_gte' => 21]); //return users with `age` field greater or equals 21
app(UserService::class)->search(['age_lt' => 16]); //return users with `age` field greater than 16
app(UserService::class)->search(['age_gt' => 21]); //return users with `age` field less than 21
  1. Ability to test changes in DB table state instead of has/missing data

Native syntax

public function testClearExpiredCodes()
{
   $this->artisan('clear:verification-codes');

   $this->assertDatabaseMissing('verification_codes', [
       'is_expired' => true
   ]);
}

2.6 syntax

class VerificationCodeTest extends TestCase

   protected static ModelTestState $verificationCodesState;

   public function setUp(): void
   {
       parent::setUp();

       self::$verificationCodesState ??= new ModelTestState(VerificationCodeModel::class);
   }

   public function testClearExpiredCodes()
   {
       $this->artisan('clear:verification-codes');

       self::$verificationCodesState->assertChangesEqualsFixture('clear_codes_command');
   }

Deprecated

  1. _from/_to predefined filters now deprecated and will be removed with the next release

2.4 syntax

app(UserService::class)->search(['created_at_from' => $date]);
app(UserService::class)->search(['age_to' => 18]);

2.5 syntax

app(UserService::class)->search(['created_at_gt' => $date]);
app(UserService::class)->search(['age_lt' => 18]);

BugFix release

27 Nov 08:31
f8ee1f2
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.3...2.4

Repositories update

21 Jun 03:32
e0e8031
Compare
Choose a tag to compare

Features

1. Reset repository flags #56

After executing final repository's method - it will reset all applied flags

Old case:

$repository = app(UserRepository);

$repository->onlyTrashed()->get(); //will return only soft deleted users
$repository->updateMany([], ['is_completed' => true]); //with update is_completed field for all soft deleted users because onlyTrashed flag should be reset manually

$repository->with('role')->find(1); //will return user with id 1 with role relation
$repository->find(2); //will return user with id 2 with role relation as well because with flag should be reset manually

New case:

$repository = app(UserRepository);

$repository->onlyTrashed()->get(); //will return only soft deleted users
$repository->updateMany([], ['is_completed' => true]); //with update is_completed field for all NOT soft deleted users because onlyTrashed flag has beed reset after call get

$repository->with('role')->find(1); //will return user with id 1 with role relation
$repository->find(2); //will return user with id 2 without role relation because with flag has been reset after call find

Next flags will be automatically reset:

  • onlyTrashed
  • withTrashed
  • force
  • with
  • withCount

To have an ability to use legacy behaviour, you can use resetSettableProperties

$repository = app(UserRepository)->resetSettableProperties(false);

$repository->onlyTrashed()->get(); //will return only soft deleted users
$repository->updateMany([], ['is_completed' => true]); //with update is_completed field for all soft deleted users because onlyTrashed flag has not beed reset after call get

$repository->with('role')->find(1); //will return user with id 1 with role relation
$repository->find(2); //will return user with id 2 with role relation because with flag has not been reset after call find

2. unique_except_of_authorized_user now works with parameters #70

public function rules(): array
{
    return [
        'email' => 'filled|unique_except_of_authorized_user:clients,uuid' // will check uniqueness throughout the `clients` table by `uuid` key field instead of `id`
    ];
}

Fix

  1. HttpRequestService attempt to call json method on non JSON response now will be failed with the understandable exception #69
  2. unique_except_of_authorized_user validation rule now works with array input instead of failing #70

Breaking

  • removed deprecated methods #60 #67

Other

  • deprecate array_associate helper #68
  • updated dependencies

Full Changelog: 2.2.1...2.3

Security update

20 Jun 10:35
9f750cc
Compare
Choose a tag to compare

What's Changed

  • fix: call json method with non json response by @Goodmain in #72
  • style: change InvalidJSONFormatException message text by @Goodmain in #75
  • fix: unique_except_of_authorized_user fails when value is array by @Goodmain in #74

Full Changelog: 1.6.1...1.6.2

Exporter types fix

10 Apr 10:59
Compare
Choose a tag to compare
Exporter types fix Pre-release
Pre-release

fix: Exporter methods types

AssertMailEquals release

08 Feb 05:49
063354c
Compare
Choose a tag to compare

What's Changed

  • feat: use onlyTrashed in searchQuery by @pirs1337 in #55
  • chore(deps): bump tecnickcom/tcpdf from 6.0.099 to 6.2.22 by @dependabot in #54
  • chore(deps): bump symfony/http-kernel from 5.4.19 to 5.4.20 by @dependabot in #57
  • feat: add the ability to test the From field for email by @t0xas in #58

New Contributors

Full Changelog: 2.2...2.2.1