Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/449/root/var/www/app/vendor/inertiajs/inertia-laravel/src/Testing/ |
Upload File : |
<?php namespace Inertia\Testing; use Closure; use const E_USER_DEPRECATED; use Illuminate\Support\Traits\Macroable; use PHPUnit\Framework\Assert as PHPUnit; use Illuminate\Contracts\Support\Arrayable; use PHPUnit\Framework\AssertionFailedError; class Assert implements Arrayable { use Concerns\Has; use Concerns\Matching; use Concerns\Debugging; use Concerns\PageObject; use Concerns\Interaction; use Macroable; /** @var string */ private $component; /** @var array */ private $props; /** @var string */ private $url; /** @var string|null */ private $version; /** @var string */ private $path; protected function __construct(string $component, array $props, string $url, string $version = null, string $path = null) { echo "\033[0;31mInertia's built-in 'Assert' library will be removed in a future version of inertia-laravel:\033[0m\n"; echo "\033[0;31m - If you are seeing this error while using \$response->assertInertia(...), please upgrade to Laravel 8.32.0 or higher.\033[0m\n"; echo "\033[0;31m - If you are using the 'Assert' class directly, please adapt your tests to use the 'AssertableInertia' class instead.\033[0m\n"; echo "\033[0;31mFor more information and questions, please see https://github.com/inertiajs/inertia-laravel/pull/338 \033[0m\n\n"; @trigger_error("Inertia's built-in 'Assert' library will be removed in a future version of inertia-laravel: https://github.com/inertiajs/inertia-laravel/pull/338", E_USER_DEPRECATED); $this->path = $path; $this->component = $component; $this->props = $props; $this->url = $url; $this->version = $version; } protected function dotPath(string $key): string { if (is_null($this->path)) { return $key; } return implode('.', [$this->path, $key]); } protected function scope(string $key, Closure $callback): self { $props = $this->prop($key); $path = $this->dotPath($key); PHPUnit::assertIsArray($props, sprintf('Inertia property [%s] is not scopeable.', $path)); $scope = new self($this->component, $props, $this->url, $this->version, $path); $callback($scope); $scope->interacted(); return $this; } public static function fromTestResponse($response): self { try { $response->assertViewHas('page'); $page = json_decode(json_encode($response->viewData('page')), true); PHPUnit::assertIsArray($page); PHPUnit::assertArrayHasKey('component', $page); PHPUnit::assertArrayHasKey('props', $page); PHPUnit::assertArrayHasKey('url', $page); PHPUnit::assertArrayHasKey('version', $page); } catch (AssertionFailedError $e) { PHPUnit::fail('Not a valid Inertia response.'); } return new self($page['component'], $page['props'], $page['url'], $page['version']); } }