generate(); $this->assertEquals(16, strlen($password)); } public function testGenerateContainsRequiredCharacters() { $generator = new PasswordGenerator(12); $password = $generator->generate(); $this->assertMatchesRegularExpression('/[a-z]/', $password); $this->assertMatchesRegularExpression('/[A-Z]/', $password); $this->assertMatchesRegularExpression('/[0-9]/', $password); $this->assertMatchesRegularExpression('/[@#_\-]/', $password); } public function testInvalidLengthThrowsException() { $this->expectException(\InvalidArgumentException::class); new PasswordGenerator(3); } }