Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
enricodelazzari committed Oct 2, 2024
1 parent 1f35a5e commit 63f8d4e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 52 deletions.
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"pest_2.35.1","defects":{"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#(Closure) \/ (Closure)":8,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields') #2":8,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields') #1":8,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields')":8,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_without_mass_prunable_fields')":8},"times":{"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_fire_model_updated_events#(Closure)":0.01,"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_not_update_non_prunable_models#(Closure)":0.002,"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_update_prunable_models#(Closure)":0.005,"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_fire_ModelsFieldsPruned_event_with_prunable_model#(Closure)":0.01,"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_allow_the_prunable_models_to_be_overridden_at_runtime#(Closure)":0.025,"P\\Tests\\PrunableFieldsTest::__pest_evaluable_should_call_the_pruningFields_method#(Closure)":0.01,"P\\Tests\\PruneFieldsCommandTest::__pest_evaluable_should_print_the_amount_of_pruned_records#(Closure)":0.012,"P\\Tests\\PruneFieldsCommandTest::__pest_evaluable_should_print_no_records_have_been_pruned#(Closure)":0.001,"P\\Tests\\PruneFieldsCommandTest::__pest_evaluable_should_print_the_amount_of_prunable_records#(Closure)":0.003,"P\\Tests\\PruneFieldsCommandTest::__pest_evaluable_should_print_no_models_found_with_empty_list":0.001,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#(Closure) \/ (Closure)":0.009,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_fire_ModelsFieldsPruned_event_with_mass_prunable_model#(Closure)":0.021,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_not_fire_model_updated_events#(Closure)":0.002,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_not_update_non_prunable_models#(Closure)":0.16,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#(Closure)":0.002,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields') #2":0.005,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields') #1":0.001,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_with_mass_prunable_fields')":0.006,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#('user_without_mass_prunable_fields')":0,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#(Closure) #2":0.002,"P\\Tests\\MassPrunableFieldsTest::__pest_evaluable_should_update_mass_prunable_models#(Closure) #1":0.001}}
25 changes: 11 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,20 @@
],
"require": {
"php": "^8.0",
"illuminate/console": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0",
"illuminate/events": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0",
"illuminate/console": "^9.0|^10.0|^11.0",
"illuminate/database": "^9.0|^10.0|^11.0",
"illuminate/events": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0",
"spatie/laravel-package-tools": "^1.14.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^7.0|^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"nunomaduro/collision": "^6.0|^7.8|^8.1",
"larastan/larastan": "^2.0.1",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"pestphp/pest": "^1.21|^2.34",
"pestphp/pest-plugin-laravel": "^1.1|^2.3",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-phpunit": "^1.3"
},
"autoload": {
"psr-4": {
Expand Down
58 changes: 21 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Maize Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Maize Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
10 changes: 10 additions & 0 deletions tests/Datasets/MassPrunableUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
]);
});

dataset('users_with_mass_prunable_fields', function () {
yield fn () => MassPrunableUser::factory()->create([
'created_at' => now()->subMonth(),
]);

yield fn () => MassPrunableUser::factory()->create([
'created_at' => now()->subMonth(),
]);
});

dataset('user_without_mass_prunable_fields', function () {
yield fn () => MassPrunableUser::factory()->create();
});
2 changes: 1 addition & 1 deletion tests/MassPrunableFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'last_name' => null,
'email' => $model->email,
]);
})->with('user_with_mass_prunable_fields', 'user_with_mass_prunable_fields');
})->with('users_with_mass_prunable_fields');

test('should not update non prunable models', function (MassPrunableUser $model) {
pruneFields([
Expand Down

0 comments on commit 63f8d4e

Please sign in to comment.