tests: Remove @expectException annotation.

This commit is contained in:
Pol Dellaiera 2021-12-21 16:22:31 +01:00
parent f93b1935ee
commit 6a0ce72836
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
3 changed files with 18 additions and 22 deletions

View File

@ -11,8 +11,11 @@ declare(strict_types=1);
namespace Chill\MainBundle\Test\Search; namespace Chill\MainBundle\Test\Search;
use Chill\MainBundle\Search\ParsingException;
use Chill\MainBundle\Search\SearchInterface; use Chill\MainBundle\Search\SearchInterface;
use Chill\MainBundle\Search\SearchProvider; use Chill\MainBundle\Search\SearchProvider;
use Chill\MainBundle\Search\UnknowSearchDomainException;
use Chill\MainBundle\Search\UnknowSearchNameException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
/** /**
@ -100,20 +103,18 @@ final class SearchProviderTest extends TestCase
], $terms); ], $terms);
} }
/**
* @expectedException \Chill\MainBundle\Search\UnknowSearchNameException
*/
public function testInvalidSearchName() public function testInvalidSearchName()
{ {
$this->expectException(UnknowSearchNameException::class);
$this->search->getByName('invalid name'); $this->search->getByName('invalid name');
} }
/**
* @expectedException \Chill\MainBundle\Search\ParsingException
*/
public function testMultipleDomainError() public function testMultipleDomainError()
{ {
$term = $this->p('@person @report'); $this->expectException(ParsingException::class);
$this->p('@person @report');
} }
/** /**
@ -146,14 +147,11 @@ final class SearchProviderTest extends TestCase
], $response); ], $response);
} }
/**
* @expectedException \Chill\MainBundle\Search\UnknowSearchDomainException
*/
public function testSearchResultDomainUnknow() public function testSearchResultDomainUnknow()
{ {
$response = $this->search->getSearchResults('@unknow domain'); $this->expectException(UnknowSearchDomainException::class);
//$this->markTestSkipped(); $this->search->getSearchResults('@unknow domain');
} }
public function testSearchWithinSpecificSearchName() public function testSearchWithinSpecificSearchName()
@ -169,12 +167,11 @@ final class SearchProviderTest extends TestCase
$this->assertEquals('I am domain foo', $response); $this->assertEquals('I am domain foo', $response);
} }
/**
* @expectedException \Chill\MainBundle\Search\ParsingException
*/
public function testSearchWithinSpecificSearchNameInConflictWithSupport() public function testSearchWithinSpecificSearchNameInConflictWithSupport()
{ {
$response = $this->search->getResultByName('@foo default search', 'bar'); $this->expectException(ParsingException::class);
$this->search->getResultByName('@foo default search', 'bar');
} }
public function testSimplePattern() public function testSimplePattern()

View File

@ -55,11 +55,10 @@ final class TokenManagerTest extends KernelTestCase
$this->assertEquals($user->getUsernameCanonical(), $tokens['u']); $this->assertEquals($user->getUsernameCanonical(), $tokens['u']);
} }
/**
* @expectedException \UnexpectedValueException
*/
public function testGenerateEmptyUsernameCanonical() public function testGenerateEmptyUsernameCanonical()
{ {
$this->expectException(\UnexpectedValueException::class);
$tokenManager = $this->tokenManager; $tokenManager = $this->tokenManager;
// set a username, but not a username canonical // set a username, but not a username canonical
$user = (new User())->setUsername('test'); $user = (new User())->setUsername('test');

View File

@ -49,13 +49,13 @@ final class PickPersonTypeTest extends KernelTestCase
/** /**
* test with an invalid center type in the option 'centers' (in an array). * test with an invalid center type in the option 'centers' (in an array).
*
* @expectedException \RuntimeException
*/ */
public function testWithInvalidOptionCenters() public function testWithInvalidOptionCenters()
{ {
$this->expectException(\RuntimeException::class);
$this->markTestSkipped('need to inject locale into url generator without request'); $this->markTestSkipped('need to inject locale into url generator without request');
$form = $this->formFactory $this->formFactory
->createBuilder(PickPersonType::class, null, [ ->createBuilder(PickPersonType::class, null, [
'centers' => ['string'], 'centers' => ['string'],
]) ])