Releases: RonasIT/laravel-helpers
Releases · RonasIT/laravel-helpers
LaravelNova Testing helpers
What's Changed
- chore(deps): bump phpoffice/phpspreadsheet from 1.29.0 to 1.29.1 by @dependabot in #141
- chore(deps): bump phpoffice/phpspreadsheet from 1.29.1 to 1.29.2 by @dependabot in #143
- feat: set up project to use Paratest; by @vitgrams in #142
- feat: modify nova test trait by @AZabolotnikov in #144
New Contributors
Full Changelog: 3.0.0-beta...3.0.1-beta
Upgrade dependencies update
What's Changed
- Update min Laravel version to 8.83 by @Goodmain in #127
- Laravel min version 10.48 by @Goodmain in #128
- feat: revert filterByList functionality by @DenTray in #130
- Fix warning with logging by @Goodmain in #131
- fix: error when truncate tables with the reserved words by @Goodmain in #134
- fix: error when the query string contains apostrophe by @Goodmain in #135
- Update MockMailsTrait code after update to Laravel 10 by @Goodmain in #137
- Update dependencies by @aizlee in #139
New Contributors
Full Changelog: 2.7...3.0.0-beta
Versioning release
What's Changed
- 77 Implement 'list_exists' validation rule by @yogyrton in #110
- chore(deps): bump tecnickcom/tcpdf from 6.2.26 to 6.7.4 by @dependabot in #113
- Exclude postgis tables from reset sequence by @Goodmain in #114
- Allow to test mail attachments by @Goodmain in #115
- Fix prepare sequence by @AZabolotnikov in #119
- Added code that allows user to work with different versions. by @ulin-evgeny in #116
- Minor code style fix by @Goodmain in #122
- Clone user pre send to actingas by @AZabolotnikov in #121
- feat: ability test emails from more senders. by @AZabolotnikov in #123
- feat: add nova test trait by @AZabolotnikov in #125
New Contributors
- @AZabolotnikov made their first contribution in #119
- @ulin-evgeny made their first contribution in #116
Full Changelog: 2.6...2.7
Mock update
Breaking changes
RonasIT\Support\Traits\MockClassTrait
renamed toRonasIT\Support\Traits\MockTrait
- All mails testing logic moved to the new
RonasIT\Support\Traits\MailsMockTrait
- Mails classes should extends
RonasIT\Support\Mail
Deprecated
- SearchTrait:
- filterMoreThan
- filterLessThan
- filterMoreOrEqualThan
- filterLessOrEqualThan
All Changes
- Prepare to phpunit10 by @Goodmain in #100
- Mock native functions by @Goodmain in #103
- Test assert functions by @Goodmain in #104
- fix: supports phpunit10 by @Goodmain in #106
- feat: use model connection name to get model test state initial state… by @DenTray in #107
- Increase coverage by @Goodmain in #105
- test: cover laravel 9 mailable subject by @Goodmain in #108
- eparusov Added last() method in EntityControlTrait by @yogyrton in #94
- 95 unable to set sequence by @Goodmain in #101
- feat: add BaseMail class by @Goodmain in #109
Full Changelog: 2.5...2.6
DB State testing release
Features
- 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
- 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
_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
What's Changed
- #78 protected => public by @Adil9994 in #79
- fix: use body param as a default option for body data instead of form… by @DenTray in #82
- 65 remove private methods by @Goodmain in #80
- Remove unnecessary text convertion by @Goodmain in #83
- Refactoring CsvIterator by @Goodmain in #85
- Preparesequence ignores empty tables by @Goodmain in #84
- feat: add gt, lt, gte, lte filters by @Goodmain in #86
- fix: unable to generate requests at Windows by @Goodmain in #93
- Update TestCase by @yogyrton in #90
- fix: remove exporter query method's type hint by @DenTray in #96
- fix: unable to generate requests at Windows by @Goodmain in #97
New Contributors
Full Changelog: 2.3...2.4
Repositories update
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
- HttpRequestService attempt to call
json
method on non JSON response now will be failed with the understandable exception #69 unique_except_of_authorized_user
validation rule now works with array input instead of failing #70
Breaking
Other
- deprecate
array_associate
helper #68 - updated dependencies
Full Changelog: 2.2.1...2.3
Security update
Exporter types fix
fix: Exporter methods types
AssertMailEquals release
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
- @dependabot made their first contribution in #54
- @t0xas made their first contribution in #58
Full Changelog: 2.2...2.2.1