Skip to content

Commit 4bcfac1

Browse files
33294: Code refactoring after code review
1 parent 1a71fe7 commit 4bcfac1

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/Magento/FunctionalTestingFramework/Allure/Event/AddUniqueAttachmentEvent.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,6 @@ class AddUniqueAttachmentEvent extends AddAttachmentEvent
2121
*/
2222
private static $instance;
2323

24-
/**
25-
* An alternative way to instantiate an instance of this class. Used to mock this class object in unit tests.
26-
*
27-
* @param mixed $filePathOrContents
28-
* @param string $caption
29-
* @param string|null $type
30-
*
31-
* @return AddUniqueAttachmentEvent
32-
*/
33-
public static function getInstance(
34-
$filePathOrContents,
35-
string $caption,
36-
?string $type = null
37-
): AddUniqueAttachmentEvent {
38-
if (!self::$instance) {
39-
self::$instance = new AddUniqueAttachmentEvent(
40-
$filePathOrContents,
41-
$caption,
42-
$type
43-
);
44-
}
45-
return self::$instance;
46-
}
47-
4824
/**
4925
* Near copy of parent function, added uniqid call for filename to prevent buggy allure behavior.
5026
*
@@ -93,6 +69,30 @@ public function copyFile(string $filePath, string $outputPath): bool
9369
return copy($filePath, $outputPath);
9470
}
9571

72+
/**
73+
* Unit test helper function.
74+
*
75+
* @param mixed $filePathOrContents
76+
* @param string $caption
77+
* @param string|null $type
78+
*
79+
* @return AddUniqueAttachmentEvent
80+
*/
81+
public static function getInstance(
82+
$filePathOrContents,
83+
string $caption,
84+
?string $type = null
85+
): AddUniqueAttachmentEvent {
86+
if (!self::$instance) {
87+
self::$instance = new AddUniqueAttachmentEvent(
88+
$filePathOrContents,
89+
$caption,
90+
$type
91+
);
92+
}
93+
return self::$instance;
94+
}
95+
9696
/**
9797
* Copy of parent private function.
9898
*

0 commit comments

Comments
 (0)