Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP Fatal Error deleteDirectoryRecursive function in MinifyApplicationCommand #249

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

LunashaGit
Copy link
Contributor

Fix for PHP Fatal error: A void function must not return a value in src\Commands\MinifyApplicationCommand.php on line 92

@LunashaGit
Copy link
Contributor Author

LunashaGit commented Feb 7, 2024

Without the fix in file MinifyApplicationCommand

 WARN  Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

   WARN  No code coverage driver available

   PASS  Tests\MenuBar\MenuBarTest
  ✓ it menubar with create                                                                                                                                                                                    0.82s  

   PASS  Tests\Http\Controller\DispatchEventFromAppControllerTest
  ✓ it dispatches no event in case it does not exist                                                                                                                                                          0.04s  
  ✓ it passes the payload to the event                                                                                                                                                                        0.01s  
  ✓ it dispatches an event                                                                                                                                                                                    0.01s  

   FAIL  Tests\Windows\WindowTest
  ✓ it test title bar for window                                                                                                                                                                              0.03s  
  ✓ it test window                                                                                                                                                                                            0.01s  
  ⨯ it test for invisibleFrameless in window                                                                                                                                                                  0.04s  
PHP Fatal error:  A void function must not return a value in C:\Users\XXX\XXX\laravel-nativephp\src\Commands\MinifyApplicationCommand.php on line 92

With the fix

PS C:\Users\XXX\XXX\laravel-nativephp> .\vendor\bin\pest
   WARN  Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

   WARN  No code coverage driver available

   PASS  Tests\Http\Controller\NativeAppBootedControllerTest
  ✓ it boots the NativePHP provider                                                                                                                                                                           0.18s  

   PASS  Tests\Http\Controller\DispatchEventFromAppControllerTest
  ✓ it dispatches an event                                                                                                                                                                                    0.02s  
  ✓ it dispatches no event in case it does not exist                                                                                                                                                          0.01s  
  ✓ it passes the payload to the event                                                                                                                                                                        0.01s  

   PASS  Tests\Http\Controller\CreateSecurityCookieControllerTest
  ✓ it create security cookie                                                                                                                                                                                 0.02s  
  ✓ it check if secret is not equal of config secret key abort 403 page                                                                                                                                       0.03s  

   PASS  Tests\MenuBar\MenuBarTest
  ✓ it menubar with create                                                                                                                                                                                    0.50s  

   PASS  Tests\Windows\WindowTest
  ✓ it test title bar for window                                                                                                                                                                              0.04s  
  ✓ it test window                                                                                                                                                                                            0.01s  

   PASS  Tests\Command\IgnoreFilesAndFoldersTest
  ✓ it will remove only files that match a globbed path                                                                                                                                                       0.08s  
  ✓ it will remove the content folder by default before building                                                                                                                                              0.02s  
  ✓ it will remove laravel.log by default before building                                                                                                                                                     0.02s  

  Tests:    12 passed (45 assertions)
  Duration: 1.28s

Just one function crashes (test for invisibleFrameless in window), I'm on Windows, not MacOS or Linux, i don't know if it's why the problem is there. ( So i just put it, in comments )

  it('test for invisibleFrameless in window', function () {
    $window = Window::open()->invisibleFrameless();
    $windowArray = $window->toArray();

    expect($windowArray['frame'])->toBeTrue();
    expect($windowArray['transparent'])->toBeTrue();
    expect($windowArray['focusable'])->toBeFalse();
    expect($windowArray['hasShadow'])->toBeFalse();
});

Without this test, everything is fine.

@LunashaGit
Copy link
Contributor Author

LunashaGit commented Feb 7, 2024

Hello @simonhamp can you check my comment about the tests please ? 😄

Without the fix in file MinifyApplicationCommand

 WARN  Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

   WARN  No code coverage driver available

   PASS  Tests\MenuBar\MenuBarTest
  ✓ it menubar with create                                                                                                                                                                                    0.82s  

   PASS  Tests\Http\Controller\DispatchEventFromAppControllerTest
  ✓ it dispatches no event in case it does not exist                                                                                                                                                          0.04s  
  ✓ it passes the payload to the event                                                                                                                                                                        0.01s  
  ✓ it dispatches an event                                                                                                                                                                                    0.01s  

   FAIL  Tests\Windows\WindowTest
  ✓ it test title bar for window                                                                                                                                                                              0.03s  
  ✓ it test window                                                                                                                                                                                            0.01s  
  ⨯ it test for invisibleFrameless in window                                                                                                                                                                  0.04s  
PHP Fatal error:  A void function must not return a value in C:\Users\XXX\XXX\laravel-nativephp\src\Commands\MinifyApplicationCommand.php on line 92

With the fix

PS C:\Users\XXX\XXX\laravel-nativephp> .\vendor\bin\pest
   WARN  Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

   WARN  No code coverage driver available

   PASS  Tests\Http\Controller\NativeAppBootedControllerTest
  ✓ it boots the NativePHP provider                                                                                                                                                                           0.18s  

   PASS  Tests\Http\Controller\DispatchEventFromAppControllerTest
  ✓ it dispatches an event                                                                                                                                                                                    0.02s  
  ✓ it dispatches no event in case it does not exist                                                                                                                                                          0.01s  
  ✓ it passes the payload to the event                                                                                                                                                                        0.01s  

   PASS  Tests\Http\Controller\CreateSecurityCookieControllerTest
  ✓ it create security cookie                                                                                                                                                                                 0.02s  
  ✓ it check if secret is not equal of config secret key abort 403 page                                                                                                                                       0.03s  

   PASS  Tests\MenuBar\MenuBarTest
  ✓ it menubar with create                                                                                                                                                                                    0.50s  

   PASS  Tests\Windows\WindowTest
  ✓ it test title bar for window                                                                                                                                                                              0.04s  
  ✓ it test window                                                                                                                                                                                            0.01s  

   PASS  Tests\Command\IgnoreFilesAndFoldersTest
  ✓ it will remove only files that match a globbed path                                                                                                                                                       0.08s  
  ✓ it will remove the content folder by default before building                                                                                                                                              0.02s  
  ✓ it will remove laravel.log by default before building                                                                                                                                                     0.02s  

  Tests:    12 passed (45 assertions)
  Duration: 1.28s

Just one function crashes (test for invisibleFrameless in window), I'm on Windows, not MacOS or Linux, i don't know if it's why the problem is there. ( So i just put it, in comments )

  it('test for invisibleFrameless in window', function () {
    $window = Window::open()->invisibleFrameless();
    $windowArray = $window->toArray();

    expect($windowArray['frame'])->toBeTrue();
    expect($windowArray['transparent'])->toBeTrue();
    expect($windowArray['focusable'])->toBeFalse();
    expect($windowArray['hasShadow'])->toBeFalse();
});

Without this test, everything is fine.

@simonhamp
Copy link
Member

Yeh I'm not to fussed about the tests not passing here at this stage. I actually bumped into the issue this PR is aiming to fix last week and have it on my pile to fix, so this saves me from doing that. Thanks 🙏

I think we can fix up the tests in a separate sweep

@LunashaGit
Copy link
Contributor Author

Ok i understand ! Thank you

@simonhamp simonhamp merged commit c699310 into NativePHP:main Feb 7, 2024
1 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants