Skip to content

Commit 3f17df1

Browse files
authored
misc (fixes #20, fixes #22, fixes #23, via #24)
1 parent d315526 commit 3f17df1

File tree

145 files changed

+204
-385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+204
-385
lines changed

composer.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"jetbrains/phpstorm-attributes": "^1",
3838
"phpunit/phpunit": "^9.5.10",
3939
"psalm/plugin-phpunit": "^0.16.1",
40-
"squizlabs/php_codesniffer": "^3.6.1",
41-
"vimeo/psalm": "^4.10"
40+
"squizlabs/php_codesniffer": "^3.6.2",
41+
"vimeo/psalm": "^4.15"
4242
},
4343
"autoload": {
4444
"psr-4": {
@@ -51,6 +51,9 @@
5151
"Qameta\\Allure\\Test\\": "test"
5252
}
5353
},
54+
"conflict": {
55+
"amphp/byte-stream": "<1.5.1"
56+
},
5457
"scripts": {
5558
"test-cs": "vendor/bin/phpcs -sp",
5659
"test-unit": "vendor/bin/phpunit --log-junit=build/log/junit.xml --coverage-clover=build/coverage/clover.xml --coverage-text",
@@ -60,10 +63,5 @@
6063
"@test-unit",
6164
"@test-psalm"
6265
]
63-
},
64-
"extra": {
65-
"branch-alias": {
66-
"dev-master": "v2.x.x-dev"
67-
}
6866
}
6967
}

src/Allure.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Closure;
88
use Qameta\Allure\Attribute\AttributeParser;
99
use Qameta\Allure\Attribute\AttributeReader;
10-
use Qameta\Allure\Exception\OutputDirectorySetFailureException;
1110
use Qameta\Allure\Internal\StepContext;
1211
use Qameta\Allure\Internal\LifecycleBuilder;
1312
use Qameta\Allure\Io\DataSourceFactory;
@@ -36,15 +35,12 @@
3635

3736
final class Allure
3837
{
39-
4038
private const DEFAULT_STEP_NAME = 'step';
4139

4240
private static ?self $instance = null;
4341

4442
private ?LifecycleBuilderInterface $lifecycleBuilder = null;
4543

46-
private ?string $outputDirectory = null;
47-
4844
private ?AllureLifecycleInterface $lifecycle = null;
4945

5046
private string $defaultStepName = self::DEFAULT_STEP_NAME;
@@ -60,9 +56,12 @@ public static function reset(): void
6056
self::$instance = null;
6157
}
6258

59+
/**
60+
* @deprecated Please use lifecycle configurator to set output directory.
61+
*/
6362
public static function setOutputDirectory(string $outputDirectory): void
6463
{
65-
self::getInstance()->doSetOutputDirectory($outputDirectory);
64+
self::getLifecycleConfigurator()->setOutputDirectory($outputDirectory);
6665
}
6766

6867
public static function getLifecycleConfigurator(): LifecycleConfiguratorInterface
@@ -305,14 +304,6 @@ public static function setLifecycleBuilder(LifecycleBuilderInterface $builder):
305304
self::getInstance()->lifecycleBuilder = $builder;
306305
}
307306

308-
private function doSetOutputDirectory(string $outputDirectory): void
309-
{
310-
if (isset($this->resultsWriter)) {
311-
throw new OutputDirectorySetFailureException();
312-
}
313-
$this->outputDirectory = $outputDirectory;
314-
}
315-
316307
private function doGetLifecycle(): AllureLifecycleInterface
317308
{
318309
return $this->lifecycle ??= $this->getLifecycleFactory()->createLifecycle($this->getResultsWriter());
@@ -343,16 +334,11 @@ private function getLifecycleFactory(): LifecycleFactoryInterface
343334
return $this->getLifecycleBuilder();
344335
}
345336

346-
private function getOutputDirectory(): string
347-
{
348-
return $this->outputDirectory ?? throw new Exception\OutputDirectoryUndefinedException();
349-
}
350-
351337
private function getResultsWriter(): ResultsWriterInterface
352338
{
353339
return $this->resultsWriter ??= $this
354340
->getLifecycleFactory()
355-
->createResultsWriter($this->getOutputDirectory());
341+
->createResultsWriter();
356342
}
357343

358344
private function doAddStep(string $name, ?Status $status = null): void

src/AllureLifecycleInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
interface AllureLifecycleInterface
1515
{
16-
1716
public function switchThread(?string $thread): void;
1817

1918
public function getCurrentTest(): ?string;

src/Attribute/AbstractDescription.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
abstract class AbstractDescription implements DescriptionInterface
88
{
9-
109
public function __construct(
1110
private string $value,
1211
private bool $isHtml,

src/Attribute/AbstractLabel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
abstract class AbstractLabel implements LabelInterface
88
{
9-
109
public function __construct(
1110
private string $name,
1211
private ?string $value = null,

src/Attribute/AbstractLink.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
abstract class AbstractLink implements LinkInterface
88
{
9-
109
public function __construct(
1110
private ?string $name = null,
1211
private ?string $url = null,

src/Attribute/AbstractParameter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
abstract class AbstractParameter implements ParameterInterface
88
{
9-
109
public function __construct(
1110
private string $name,
1211
private ?string $value,

src/Attribute/AttributeReader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
final class AttributeReader implements AttributeReaderInterface
2020
{
21-
2221
/**
2322
* @param ReflectionClass $class
2423
* @param class-string|null $name

src/Attribute/AttributeReaderInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
interface AttributeReaderInterface
1313
{
14-
1514
/**
1615
* @param ReflectionClass $class
1716
* @param class-string|null $name

src/Attribute/Description.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
1010
final class Description extends AbstractDescription
1111
{
12-
1312
public function __construct(string $value, bool $isHtml = false)
1413
{
1514
parent::__construct($value, $isHtml);

0 commit comments

Comments
 (0)