mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Merge pull request #97 from fkraefft/fix-traits
Fix in Test Repository use method.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ coverage.xml
|
||||
.temp/coverage.php
|
||||
*.swp
|
||||
*.swo
|
||||
.vscode/
|
||||
@ -104,7 +104,14 @@ final class TestRepository
|
||||
}
|
||||
|
||||
foreach ($paths as $path) {
|
||||
$this->uses[$path] = [$classOrTraits, $groups];
|
||||
if (array_key_exists($path, $this->uses)) {
|
||||
$this->uses[$path] = [
|
||||
array_merge($this->uses[$path][0], $classOrTraits),
|
||||
array_merge($this->uses[$path][1], $groups),
|
||||
];
|
||||
} else {
|
||||
$this->uses[$path] = [$classOrTraits, $groups];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +101,7 @@
|
||||
|
||||
PASS Tests\Plugins\Traits
|
||||
✓ it allows global uses
|
||||
✓ it allows multiple global uses registered in the same path
|
||||
|
||||
PASS Tests\Unit\Actions\AddsDefaults
|
||||
✓ it sets defaults
|
||||
@ -143,5 +144,5 @@
|
||||
WARN Tests\Visual\Success
|
||||
s visual snapshot of test suite on success
|
||||
|
||||
Tests: 6 skipped, 78 passed
|
||||
Time: 3.09s
|
||||
Tests: 6 skipped, 79 passed
|
||||
Time: 3.44s
|
||||
|
||||
@ -12,4 +12,13 @@ trait PluginTrait
|
||||
}
|
||||
}
|
||||
|
||||
trait SecondPluginTrait
|
||||
{
|
||||
public function assertSecondPluginTraitGotRegistered(): void
|
||||
{
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
Pest\Plugin::uses(PluginTrait::class);
|
||||
Pest\Plugin::uses(SecondPluginTrait::class);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
<?php
|
||||
|
||||
it('allows global uses')->assertPluginTraitGotRegistered();
|
||||
|
||||
it('allows multiple global uses registered in the same path')->assertSecondPluginTraitGotRegistered();
|
||||
|
||||
Reference in New Issue
Block a user