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

+5-7
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

+5-19
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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);

src/Attribute/DisplayNameInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66

77
interface DisplayNameInterface extends AttributeInterface
88
{
9-
109
public function getValue(): string;
1110
}

src/Attribute/Epic.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
final class Epic extends AbstractLabel
1111
{
12-
1312
public function __construct(string $value)
1413
{
1514
parent::__construct(Label::EPIC, $value);

src/Attribute/Feature.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
final class Feature extends AbstractLabel
1111
{
12-
1312
public function __construct(string $value)
1413
{
1514
parent::__construct(Label::FEATURE, $value);

src/Attribute/Issue.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
final class Issue extends AbstractLink
1111
{
12-
1312
public function __construct(?string $name = null, ?string $url = null)
1413
{
1514
parent::__construct($name, $url, Link::ISSUE);

src/Attribute/Label.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1111
final class Label extends AbstractLabel
1212
{
13-
1413
public const ALLURE_ID = Model\Label::ALLURE_ID;
1514
public const SUITE = Model\Label::SUITE;
1615
public const PARENT_SUITE = Model\Label::PARENT_SUITE;

src/Attribute/LabelInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
interface LabelInterface extends AttributeInterface
88
{
9-
109
public function getName(): string;
1110

1211
public function getValue(): ?string;

src/Attribute/LegacyAttributeReader.php

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
final class LegacyAttributeReader implements AttributeReaderInterface
2121
{
22-
2322
private Reader $legacyDelegate;
2423

2524
public function __construct(

src/Attribute/Link.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1111
final class Link extends AbstractLink
1212
{
13-
1413
public const CUSTOM = Model\LinkType::CUSTOM;
1514
public const ISSUE = Model\LinkType::ISSUE;
1615
public const TMS = Model\LinkType::TMS;

src/Attribute/LinkInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
interface LinkInterface extends AttributeInterface
88
{
9-
109
public function getName(): ?string;
1110

1211
public function getUrl(): ?string;

src/Attribute/Parameter.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION | Attribute::IS_REPEATABLE)]
1111
class Parameter extends AbstractParameter
1212
{
13-
1413
public function __construct(
1514
string $name,
1615
?string $value,

src/Attribute/ParameterInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
interface ParameterInterface extends AttributeInterface
88
{
9-
109
public function getName(): string;
1110

1211
public function getValue(): ?string;

src/Attribute/ParameterMode.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
final class ParameterMode
1010
{
11-
1211
public const HIDDEN = Model\ParameterMode::HIDDEN;
1312
public const MASKED = Model\ParameterMode::MASKED;
1413
}

src/Attribute/Story.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
final class Story extends AbstractLabel
1111
{
12-
1312
public function __construct(string $value)
1413
{
1514
parent::__construct(Label::STORY, $value);

src/Attribute/TmsLink.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
final class TmsLink extends AbstractLink
1111
{
12-
1312
public function __construct(?string $name = null, ?string $url = null)
1413
{
1514
parent::__construct($name, $url, Link::TMS);

src/Exception/ActiveContainerNotFoundException.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
final class ActiveContainerNotFoundException extends LogicException
1111
{
12-
1312
public function __construct(Throwable $previous = null)
1413
{
1514
parent::__construct("Active container not found", 0, $previous);

src/Exception/ActiveExecutionContextNotFoundException.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
final class ActiveExecutionContextNotFoundException extends LogicException
1111
{
12-
1312
public function __construct(Throwable $previous = null)
1413
{
1514
parent::__construct("Active test, fixture or step not found", 0, $previous);

src/Exception/ActiveStepNotFoundException.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
final class ActiveStepNotFoundException extends LogicException
1111
{
12-
1312
public function __construct(Throwable $previous = null)
1413
{
1514
parent::__construct("Active step not found", 0, $previous);

src/Exception/ActiveTestNotFoundException.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
final class ActiveTestNotFoundException extends LogicException
1111
{
12-
1312
public function __construct(Throwable $previous = null)
1413
{
1514
parent::__construct("Active test or fixture not found", 0, $previous);

src/Exception/InvalidExecutionContextException.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
final class InvalidExecutionContextException extends DomainException
1212
{
13-
1413
public function __construct(
1514
private ExecutionContextInterface $context,
1615
?Throwable $previous = null,

src/Exception/InvalidMethodNameException.php

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
final class InvalidMethodNameException extends \DomainException
1313
{
14-
1514
public function __construct(
1615
private mixed $methodName,
1716
Throwable $previous = null,

src/Exception/OutputDirectorySetFailureException.php

-21
This file was deleted.

src/Exception/OutputDirectoryUndefinedException.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
final class OutputDirectoryUndefinedException extends LogicException
1212
{
13-
1413
public function __construct(?Throwable $previous = null)
1514
{
1615
$class = Allure::class;

src/Hook/AfterAttachmentWriteHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterAttachmentWriteHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterAttachmentWrite(AttachmentResult $attachment): void;
1312
}

src/Hook/AfterContainerStartHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterContainerStartHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterContainerStart(ContainerResult $container): void;
1312
}

src/Hook/AfterContainerStopHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterContainerStopHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterContainerStop(ContainerResult $container): void;
1312
}

src/Hook/AfterContainerUpdateHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterContainerUpdateHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterContainerUpdate(ContainerResult $container): void;
1312
}

src/Hook/AfterContainerWriteHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterContainerWriteHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterContainerWrite(ContainerResult $container): void;
1312
}

src/Hook/AfterFixtureStartHookInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
interface AfterFixtureStartHookInterface extends LifecycleHookInterface
1010
{
11-
1211
public function afterFixtureStart(FixtureResult $fixture): void;
1312
}

0 commit comments

Comments
 (0)