7
7
use Closure ;
8
8
use Qameta \Allure \Attribute \AttributeParser ;
9
9
use Qameta \Allure \Attribute \AttributeReader ;
10
- use Qameta \Allure \Exception \OutputDirectorySetFailureException ;
11
10
use Qameta \Allure \Internal \StepContext ;
12
11
use Qameta \Allure \Internal \LifecycleBuilder ;
13
12
use Qameta \Allure \Io \DataSourceFactory ;
36
35
37
36
final class Allure
38
37
{
39
-
40
38
private const DEFAULT_STEP_NAME = 'step ' ;
41
39
42
40
private static ?self $ instance = null ;
43
41
44
42
private ?LifecycleBuilderInterface $ lifecycleBuilder = null ;
45
43
46
- private ?string $ outputDirectory = null ;
47
-
48
44
private ?AllureLifecycleInterface $ lifecycle = null ;
49
45
50
46
private string $ defaultStepName = self ::DEFAULT_STEP_NAME ;
@@ -60,9 +56,12 @@ public static function reset(): void
60
56
self ::$ instance = null ;
61
57
}
62
58
59
+ /**
60
+ * @deprecated Please use lifecycle configurator to set output directory.
61
+ */
63
62
public static function setOutputDirectory (string $ outputDirectory ): void
64
63
{
65
- self ::getInstance ()->doSetOutputDirectory ($ outputDirectory );
64
+ self ::getLifecycleConfigurator ()->setOutputDirectory ($ outputDirectory );
66
65
}
67
66
68
67
public static function getLifecycleConfigurator (): LifecycleConfiguratorInterface
@@ -305,14 +304,6 @@ public static function setLifecycleBuilder(LifecycleBuilderInterface $builder):
305
304
self ::getInstance ()->lifecycleBuilder = $ builder ;
306
305
}
307
306
308
- private function doSetOutputDirectory (string $ outputDirectory ): void
309
- {
310
- if (isset ($ this ->resultsWriter )) {
311
- throw new OutputDirectorySetFailureException ();
312
- }
313
- $ this ->outputDirectory = $ outputDirectory ;
314
- }
315
-
316
307
private function doGetLifecycle (): AllureLifecycleInterface
317
308
{
318
309
return $ this ->lifecycle ??= $ this ->getLifecycleFactory ()->createLifecycle ($ this ->getResultsWriter ());
@@ -343,16 +334,11 @@ private function getLifecycleFactory(): LifecycleFactoryInterface
343
334
return $ this ->getLifecycleBuilder ();
344
335
}
345
336
346
- private function getOutputDirectory (): string
347
- {
348
- return $ this ->outputDirectory ?? throw new Exception \OutputDirectoryUndefinedException ();
349
- }
350
-
351
337
private function getResultsWriter (): ResultsWriterInterface
352
338
{
353
339
return $ this ->resultsWriter ??= $ this
354
340
->getLifecycleFactory ()
355
- ->createResultsWriter ($ this -> getOutputDirectory () );
341
+ ->createResultsWriter ();
356
342
}
357
343
358
344
private function doAddStep (string $ name , ?Status $ status = null ): void
0 commit comments