Skip to content

Commit

Permalink
feat(Testing): Add ResponseFactoryAssert
Browse files Browse the repository at this point in the history
  • Loading branch information
pionl committed Jun 22, 2023
1 parent 0127431 commit d432f7b
Show file tree
Hide file tree
Showing 17 changed files with 1,421 additions and 83 deletions.
424 changes: 424 additions & 0 deletions src/Testing/Laravel/Contracts/Routing/ResponseFactoryAssert.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryDownloadExpectation
{
/**
* @param Closure(mixed, mixed, array, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $file,
public readonly mixed $name = null,
public readonly array $headers = [],
public readonly mixed $disposition = 'attachment',
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryFileExpectation
{
/**
* @param Closure(mixed, array, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $file,
public readonly array $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryJsonExpectation
{
/**
* @param Closure(mixed, mixed, array, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $data = [],
public readonly mixed $status = 200,
public readonly array $headers = [],
public readonly mixed $options = 0,
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryJsonpExpectation
{
/**
* @param Closure(mixed, mixed, mixed, array, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $callback,
public readonly mixed $data = [],
public readonly mixed $status = 200,
public readonly array $headers = [],
public readonly mixed $options = 0,
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryMakeExpectation
{
/**
* @param Closure(mixed, mixed, array, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $content = '',
public readonly mixed $status = 200,
public readonly array $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryNoContentExpectation
{
/**
* @param Closure(mixed, array, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $status = 204,
public readonly array $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryRedirectGuestExpectation
{
/**
* @param Closure(mixed, mixed, mixed, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $path,
public readonly mixed $status = 302,
public readonly mixed $headers = [],
public readonly mixed $secure = null,
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryRedirectToActionExpectation
{
/**
* @param Closure(mixed, mixed, mixed, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $action,
public readonly mixed $parameters = [],
public readonly mixed $status = 302,
public readonly mixed $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryRedirectToExpectation
{
/**
* @param Closure(mixed, mixed, mixed, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $path,
public readonly mixed $status = 302,
public readonly mixed $headers = [],
public readonly mixed $secure = null,
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryRedirectToIntendedExpectation
{
/**
* @param Closure(mixed, mixed, mixed, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $default = '/',
public readonly mixed $status = 302,
public readonly mixed $headers = [],
public readonly mixed $secure = null,
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryRedirectToRouteExpectation
{
/**
* @param Closure(mixed, mixed, mixed, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $route,
public readonly mixed $parameters = [],
public readonly mixed $status = 302,
public readonly mixed $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryStreamDownloadExpectation
{
/**
* @param Closure(mixed, mixed, array, mixed, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $name = null,
public readonly array $headers = [],
public readonly mixed $disposition = 'attachment',
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryStreamExpectation
{
/**
* @param Closure(mixed, mixed, array, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $status = 200,
public readonly array $headers = [],
public readonly ?Closure $hook = null,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaraStrict\Testing\Laravel\Contracts\Routing;

use Closure;

final class ResponseFactoryViewExpectation
{
/**
* @param Closure(mixed, mixed, mixed, array, self):void|null $hook
*/
public function __construct(
public readonly mixed $return,
public readonly mixed $view,
public readonly mixed $data = [],
public readonly mixed $status = 200,
public readonly array $headers = [],
public readonly ?Closure $hook = null,
) {
}
}

0 comments on commit d432f7b

Please sign in to comment.