diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php index 2e7aeb37f..07d7c7ab7 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php @@ -11,8 +11,11 @@ declare(strict_types=1); namespace Chill\MainBundle\Test\Search; +use Chill\MainBundle\Search\ParsingException; use Chill\MainBundle\Search\SearchInterface; use Chill\MainBundle\Search\SearchProvider; +use Chill\MainBundle\Search\UnknowSearchDomainException; +use Chill\MainBundle\Search\UnknowSearchNameException; use PHPUnit\Framework\TestCase; /** @@ -100,20 +103,18 @@ final class SearchProviderTest extends TestCase ], $terms); } - /** - * @expectedException \Chill\MainBundle\Search\UnknowSearchNameException - */ public function testInvalidSearchName() { + $this->expectException(UnknowSearchNameException::class); + $this->search->getByName('invalid name'); } - /** - * @expectedException \Chill\MainBundle\Search\ParsingException - */ 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); } - /** - * @expectedException \Chill\MainBundle\Search\UnknowSearchDomainException - */ public function testSearchResultDomainUnknow() { - $response = $this->search->getSearchResults('@unknow domain'); + $this->expectException(UnknowSearchDomainException::class); - //$this->markTestSkipped(); + $this->search->getSearchResults('@unknow domain'); } public function testSearchWithinSpecificSearchName() @@ -169,12 +167,11 @@ final class SearchProviderTest extends TestCase $this->assertEquals('I am domain foo', $response); } - /** - * @expectedException \Chill\MainBundle\Search\ParsingException - */ 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() diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index d79833416..294ddceb6 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -55,11 +55,10 @@ final class TokenManagerTest extends KernelTestCase $this->assertEquals($user->getUsernameCanonical(), $tokens['u']); } - /** - * @expectedException \UnexpectedValueException - */ public function testGenerateEmptyUsernameCanonical() { + $this->expectException(\UnexpectedValueException::class); + $tokenManager = $this->tokenManager; // set a username, but not a username canonical $user = (new User())->setUsername('test'); diff --git a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php index c3e8c0669..5c7942de3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php @@ -49,13 +49,13 @@ final class PickPersonTypeTest extends KernelTestCase /** * test with an invalid center type in the option 'centers' (in an array). - * - * @expectedException \RuntimeException */ public function testWithInvalidOptionCenters() { + $this->expectException(\RuntimeException::class); + $this->markTestSkipped('need to inject locale into url generator without request'); - $form = $this->formFactory + $this->formFactory ->createBuilder(PickPersonType::class, null, [ 'centers' => ['string'], ])