diff options
Diffstat (limited to 'tests/PHPUnit/Unit/Category/CategoryTest.php')
-rw-r--r-- | tests/PHPUnit/Unit/Category/CategoryTest.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/PHPUnit/Unit/Category/CategoryTest.php b/tests/PHPUnit/Unit/Category/CategoryTest.php index 39ae0bfb92..6d475c08a3 100644 --- a/tests/PHPUnit/Unit/Category/CategoryTest.php +++ b/tests/PHPUnit/Unit/Category/CategoryTest.php @@ -23,7 +23,7 @@ class CategoryTest extends \PHPUnit\Framework\TestCase */ private $category; - public function setUp() + public function setUp(): void { parent::setUp(); $this->category = new Category(); @@ -76,12 +76,11 @@ class CategoryTest extends \PHPUnit\Framework\TestCase $this->assertSame(array($subcategory1, $subcategory2), $this->category->getSubcategories()); } - /** - * @expectedException \Exception - * @expectedExceptionMessage Subcategory id1 already exists - */ public function test_addSubcategory_ShouldThrowException_WhenAddingSubcategoryWithSameIdTwice() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Subcategory id1 already exists'); + $subcategory1 = $this->createSubcategory('id1', 'name1'); $subcategory2 = $this->createSubcategory('id1', 'name2'); |