1414use Joli \JoliNotif \Driver \DriverInterface ;
1515use Joli \JoliNotif \Notification ;
1616use JoliCode \PhpOsHelper \OsHelper ;
17+ use PHPUnit \Framework \Attributes \DataProvider ;
1718use Symfony \Component \Process \Process ;
1819
1920/**
@@ -36,9 +37,7 @@ public function testIsSupported()
3637 $ this ->assertSame ($ supported , $ this ->getDriver ()->isSupported ());
3738 }
3839
39- /**
40- * @dataProvider provideValidNotifications
41- */
40+ #[DataProvider('provideValidNotifications ' )]
4241 public function testConfigureProcessAcceptAnyValidNotification (Notification $ notification , string $ expectedCommandLine )
4342 {
4443 try {
@@ -50,44 +49,44 @@ public function testConfigureProcessAcceptAnyValidNotification(Notification $not
5049 }
5150 }
5251
53- public function provideValidNotifications (): iterable
52+ public static function provideValidNotifications (): iterable
5453 {
5554 $ iconDir = self ::getIconDir ();
5655
5756 yield self ::BINARY . '_getExpectedCommandLineForNotification ' => [
5857 (new Notification ())
5958 ->setBody ('I \'m the notification body ' ),
60- $ this -> getExpectedCommandLineForNotification (),
59+ self :: getExpectedCommandLineForNotification (),
6160 ];
6261 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithATitle ' => [
6362 (new Notification ())
6463 ->setBody ('I \'m the notification body ' )
6564 ->setTitle ('I \'m the notification title ' ),
66- $ this -> getExpectedCommandLineForNotificationWithATitle (),
65+ self :: getExpectedCommandLineForNotificationWithATitle (),
6766 ];
6867 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithASubtitle ' => [
6968 (new Notification ())
7069 ->setBody ('I \'m the notification body ' )
7170 ->addOption ('subtitle ' , 'I \'m the notification subtitle ' ),
72- $ this -> getExpectedCommandLineForNotificationWithASubtitle (),
71+ self :: getExpectedCommandLineForNotificationWithASubtitle (),
7372 ];
7473 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithASound ' => [
7574 (new Notification ())
7675 ->setBody ('I \'m the notification body ' )
7776 ->addOption ('sound ' , 'Frog ' ),
78- $ this -> getExpectedCommandLineForNotificationWithASound (),
77+ self :: getExpectedCommandLineForNotificationWithASound (),
7978 ];
8079 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithAnUrl ' => [
8180 (new Notification ())
8281 ->setBody ('I \'m the notification body ' )
8382 ->addOption ('url ' , 'https://google.com ' ),
84- $ this -> getExpectedCommandLineForNotificationWithAnUrl (),
83+ self :: getExpectedCommandLineForNotificationWithAnUrl (),
8584 ];
8685 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithAnIcon ' => [
8786 (new Notification ())
8887 ->setBody ('I \'m the notification body ' )
8988 ->setIcon ($ iconDir . '/image.gif ' ),
90- $ this -> getExpectedCommandLineForNotificationWithAnIcon (),
89+ self :: getExpectedCommandLineForNotificationWithAnIcon (),
9190 ];
9291 yield self ::BINARY . '_getExpectedCommandLineForNotificationWithAllOptions ' => [
9392 (new Notification ())
@@ -97,7 +96,7 @@ public function provideValidNotifications(): iterable
9796 ->addOption ('sound ' , 'Frog ' )
9897 ->addOption ('url ' , 'https://google.com ' )
9998 ->setIcon ($ iconDir . '/image.gif ' ),
100- $ this -> getExpectedCommandLineForNotificationWithAllOptions (),
99+ self :: getExpectedCommandLineForNotificationWithAllOptions (),
101100 ];
102101 }
103102
@@ -132,35 +131,35 @@ public function testSendThrowsExceptionWhenNotificationHasAnEmptyBody()
132131
133132 abstract protected function getDriver (): DriverInterface ;
134133
135- abstract protected function getExpectedCommandLineForNotification (): string ;
134+ abstract protected static function getExpectedCommandLineForNotification (): string ;
136135
137- abstract protected function getExpectedCommandLineForNotificationWithATitle (): string ;
136+ abstract protected static function getExpectedCommandLineForNotificationWithATitle (): string ;
138137
139138 /**
140139 * Subtitle is supported only on few driver.
141140 */
142- protected function getExpectedCommandLineForNotificationWithASubtitle (): string
141+ protected static function getExpectedCommandLineForNotificationWithASubtitle (): string
143142 {
144- return $ this -> getExpectedCommandLineForNotification ();
143+ return static :: getExpectedCommandLineForNotification ();
145144 }
146145
147146 /**
148147 * Sound is supported only on few driver.
149148 */
150- protected function getExpectedCommandLineForNotificationWithASound (): string
149+ protected static function getExpectedCommandLineForNotificationWithASound (): string
151150 {
152- return $ this -> getExpectedCommandLineForNotification ();
151+ return static :: getExpectedCommandLineForNotification ();
153152 }
154153
155154 /**
156155 * Sound is supported only on few driver.
157156 */
158- protected function getExpectedCommandLineForNotificationWithAnUrl (): string
157+ protected static function getExpectedCommandLineForNotificationWithAnUrl (): string
159158 {
160- return $ this -> getExpectedCommandLineForNotification ();
159+ return static :: getExpectedCommandLineForNotification ();
161160 }
162161
163- abstract protected function getExpectedCommandLineForNotificationWithAnIcon (): string ;
162+ abstract protected static function getExpectedCommandLineForNotificationWithAnIcon (): string ;
164163
165- abstract protected function getExpectedCommandLineForNotificationWithAllOptions (): string ;
164+ abstract protected static function getExpectedCommandLineForNotificationWithAllOptions (): string ;
166165}
0 commit comments