Skip to content

Commit d8d5275

Browse files
authored
Merge pull request #7046 from ping-yee/refactor-static-getFile
refactor: change `getFile()` function of \CodeIgniter\Events\Events to static.
2 parents e9da460 + 71d4b5b commit d8d5275

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

system/Events/Events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static function setFiles(array $files)
246246
*
247247
* @return string[]
248248
*/
249-
public function getFiles()
249+
public static function getFiles()
250250
{
251251
return static::$files;
252252
}

tests/system/Events/EventsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ public function testInitialize()
5555

5656
// it should start out empty
5757
MockEvents::setFiles([]);
58-
$this->assertEmpty($this->manager->getFiles());
58+
$this->assertEmpty(Events::getFiles());
5959

6060
// make sure we have a default events file
6161
$default = [APPPATH . 'Config' . DIRECTORY_SEPARATOR . 'Events.php'];
6262
$this->manager->unInitialize();
6363
MockEvents::initialize();
64-
$this->assertSame($default, $this->manager->getFiles());
64+
$this->assertSame($default, Events::getFiles());
6565

6666
// but we should be able to change it through the backdoor
6767
MockEvents::setFiles(['/peanuts']);
68-
$this->assertSame(['/peanuts'], $this->manager->getFiles());
68+
$this->assertSame(['/peanuts'], Events::getFiles());
6969

7070
// re-initializing should have no effect
7171
MockEvents::initialize();
72-
$this->assertSame(['/peanuts'], $this->manager->getFiles());
72+
$this->assertSame(['/peanuts'], Events::getFiles());
7373
}
7474

7575
public function testPerformance()

0 commit comments

Comments
 (0)