How to throw an Exception with a Mock object on method call in PHPUnit

Code
<?php

use PHPUnit\Framework\TestCase;

class 
ExceptionMockTest extends TestCase
{
    public function 
testMockException() : void
    
{
        
$mock $this->createMock('Fooable');
        
$mock->expects($this->once())
            ->
method('connect')
            ->
willThrowException(new Exception('Expected Exception was thrown'));
        
        
$mock->connect();
    }
}

interface 
Fooable
{
    public function 
connect();
}
Result
Time: 00:00.006, Memory: 18.00 MB

There was 1 error:

1) ExceptionMockTest::testMockException
Expected Exception was thrown

PhpunitExec.php:21

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8