UploadedFileStub
extends UploadedFile
in package
A helper class to mock UploadedFile objects.
in test_helpers:1.3.0 and is removed from test_helpers:1.4.0.
Use the mikey179/vfsstream
package instead.
Tags
Table of Contents
Properties
- $filePath : string
- The full file path.
- $filesStorage : ArrayObject
- A static storage for files content.
Methods
- __construct() : mixed
- {@inheritdoc}
- getContent() : string
- {@inheritdoc}
- getRealPath() : mixed
- {@inheritdoc}
- getSize() : mixed
- {@inheritdoc}
- unmockPhpFunctions() : mixed
- Unmocks all mocked php internal functions to get the original behavior.
Properties
$filePath
The full file path.
private
string
$filePath
$filesStorage
A static storage for files content.
private
static ArrayObject
$filesStorage
Methods
__construct()
{@inheritdoc}
public
__construct(string $path, string $originalName[, string $mimeType = NULL ][, int $error = NULL ][, bool $test = FALSE ][, mixed $content = '' ]) : mixed
Additionally to the original constructor, you have to pass the file content via the $content argument.
Parameters
- $path : string
- $originalName : string
- $mimeType : string = NULL
- $error : int = NULL
- $test : bool = FALSE
- $content : mixed = ''
getContent()
{@inheritdoc}
public
getContent() : string
Return values
stringgetRealPath()
{@inheritdoc}
public
getRealPath() : mixed
The '#[\ReturnTypeWillChange]' attribute is used to suppress the "Return type of _ the should either be compatible" warning to keep the compatibiltiy with PHP 7.4 and 8.1 together.
Attributes
- #[ReturnTypeWillChange]
getSize()
{@inheritdoc}
public
getSize() : mixed
The '#[\ReturnTypeWillChange]' attribute is used to suppress the "Return type of _ the should either be compatible" warning to keep the compatibiltiy with PHP 7.4 and 8.1 together.
Attributes
- #[ReturnTypeWillChange]
unmockPhpFunctions()
Unmocks all mocked php internal functions to get the original behavior.
public
static unmockPhpFunctions() : mixed
Call it if you need to use original behavior of the UploadedFile class.