Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\Framework\MockObject\Rule;
11
 
12
use PHPUnit\Framework\ExpectationFailedException;
13
use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
14
 
15
/**
16
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
17
 */
18
final class InvokedAtLeastOnce extends InvocationOrder
19
{
20
    public function toString(): string
21
    {
22
        return 'invoked at least once';
23
    }
24
 
25
    /**
26
     * Verifies that the current expectation is valid. If everything is OK the
27
     * code should just return, if not it must throw an exception.
28
     *
29
     * @throws ExpectationFailedException
30
     */
31
    public function verify(): void
32
    {
33
        $count = $this->getInvocationCount();
34
 
35
        if ($count < 1) {
36
            throw new ExpectationFailedException(
37
                'Expected invocation at least once but it never occurred.'
38
            );
39
        }
40
    }
41
 
42
    public function matches(BaseInvocation $invocation): bool
43
    {
44
        return true;
45
    }
46
 
47
    protected function invokedDo(BaseInvocation $invocation): void
48
    {
49
    }
50
}