Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/codeception/stub/docs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/codeception/stub/docs/Expected.md
## Codeception\Stub\Expected



#### *public static* never($params = null) 
Checks if a method never has been invoked

If method invoked, it will immediately throw an
exception.

```php
<?php
use \Codeception\Stub\Expected;

$user = $this->make('User', [
     'getName' => Expected::never(),
     'someMethod' => function() {}
]);
$user->someMethod();
```

 * `param mixed` $params

#### *public static* once($params = null) 
Checks if a method has been invoked exactly one
time.

If the number is less or greater it will later be checked in verify() and also throw an
exception.

```php
<?php
use \Codeception\Stub\Expected;

$user = $this->make(
    'User',
    array(
        'getName' => Expected::once('Davert'),
        'someMethod' => function() {}
    )
);
$userName = $user->getName();
$this->assertEquals('Davert', $userName);
```
Alternatively, a function can be passed as parameter:

```php
<?php
Expected::once(function() { return Faker::name(); });
```

 * `param mixed` $params

#### *public static* atLeastOnce($params = null) 
Checks if a method has been invoked at least one
time.

If the number of invocations is 0 it will throw an exception in verify.

```php
<?php
use \Codeception\Stub\Expected;

$user = $this->make(
    'User',
    array(
        'getName' => Expected::atLeastOnce('Davert')),
        'someMethod' => function() {}
    )
);
$user->getName();
$userName = $user->getName();
$this->assertEquals('Davert', $userName);
```

Alternatively, a function can be passed as parameter:

```php
<?php
Expected::atLeastOnce(function() { return Faker::name(); });
```

 * `param mixed` $params

#### *public static* exactly($count, $params = null) 
Checks if a method has been invoked a certain amount
of times.
If the number of invocations exceeds the value it will immediately throw an
exception,
If the number is less it will later be checked in verify() and also throw an
exception.

``` php
<?php
use \Codeception\Stub;
use \Codeception\Stub\Expected;

$user = $this->make(
    'User',
    array(
        'getName' => Expected::exactly(3, 'Davert'),
        'someMethod' => function() {}
    )
);
$user->getName();
$user->getName();
$userName = $user->getName();
$this->assertEquals('Davert', $userName);
```
Alternatively, a function can be passed as parameter:

```php
<?php
Expected::exactly(function() { return Faker::name() });
```

 * `param mixed` $params



Spamworldpro Mini