diff --git a/src/Each.php b/src/Each.php index 08c8f753..e16933be 100644 --- a/src/Each.php +++ b/src/Each.php @@ -23,10 +23,8 @@ final class Each /** * Creates a new expectation. - * - * @param mixed $value */ - public function and($value): Expectation + public function and(mixed $value): Expectation { return $this->original->and($value); } diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index d56d163f..4863552a 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -23,31 +23,31 @@ use RuntimeException; final class TestCaseFactory { /** - * Marks this test case as only. + * Determines if the Test Case will be the "only" being run. */ public bool $only = false; /** - * Holds the test closure. + * The Test Case closure. */ public Closure $test; /** - * Holds the dataset, if any. + * The Test Case Dataset, if any. * * @var array|string> */ public array $datasets = []; /** - * The FQN of the test case class. + * The FQN of the Test Case class. * * @var class-string */ public string $class = TestCase::class; /** - * An array of FQN of the class traits. + * An array of FQN of the Test Case traits. * * @var array */ @@ -57,22 +57,22 @@ final class TestCaseFactory ]; /** - * Holds the higher order messages for the factory that are proxyable. + * The higher order messages for the factory that are proxyable. */ public HigherOrderMessageCollection $factoryProxies; /** - * Holds the higher order messages that are proxyable. + * The higher order messages that are proxyable. */ public HigherOrderMessageCollection $proxies; /** - * Holds the higher order messages that are chainable. + * The higher order messages that are chainable. */ public HigherOrderMessageCollection $chains; /** - * Creates a new anonymous test case pending object. + * Creates a new Factory instance. */ public function __construct( public string $filename, @@ -87,11 +87,11 @@ final class TestCaseFactory } /** - * Builds the anonymous test case. + * Makes the Test Case classes. * * @return array */ - public function build(TestSuite $testSuite): array + public function make(): array { if ($this->description === null) { throw ShouldNotHappen::fromMessage('Description can not be empty.'); @@ -101,10 +101,7 @@ final class TestCaseFactory $proxies = $this->proxies; $factoryTest = $this->test; - /** - * @return mixed - */ - $test = function () use ($chains, $proxies, $factoryTest) { + $testClosure = function () use ($chains, $proxies, $factoryTest): mixed { $proxies->proxy($this); $chains->chain($this); @@ -114,8 +111,8 @@ final class TestCaseFactory $className = $this->makeClassFromFilename($this->filename); - $createTest = function ($description, $data) use ($className, $test) { - $testCase = new $className($test, $description, $data); + $createTest = function ($description, $data) use ($className, $testClosure) { + $testCase = new $className($testClosure, $description, $data); $this->factoryProxies->proxy($testCase); return $testCase; @@ -127,7 +124,7 @@ final class TestCaseFactory } /** - * Makes a fully qualified class name from the given filename. + * Makes a Fully Qualified Class Name from the given filename. */ public function makeClassFromFilename(string $filename): string { diff --git a/src/Functions.php b/src/Functions.php index 855e415e..20a0ee6e 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -4,10 +4,10 @@ declare(strict_types=1); use Pest\Datasets; use Pest\Expectation; -use Pest\PendingObjects\AfterEachCall; -use Pest\PendingObjects\BeforeEachCall; -use Pest\PendingObjects\TestCall; -use Pest\PendingObjects\UsesCall; +use Pest\PendingCalls\AfterEachCall; +use Pest\PendingCalls\BeforeEachCall; +use Pest\PendingCalls\TestCall; +use Pest\PendingCalls\UsesCall; use Pest\Support\Backtrace; use Pest\Support\Extendable; use Pest\Support\HigherOrderTapProxy; diff --git a/src/Laravel/Commands/PestDatasetCommand.php b/src/Laravel/Commands/PestDatasetCommand.php index e5cab365..33ae8db8 100644 --- a/src/Laravel/Commands/PestDatasetCommand.php +++ b/src/Laravel/Commands/PestDatasetCommand.php @@ -17,7 +17,7 @@ use Pest\TestSuite; final class PestDatasetCommand extends Command { /** - * The console command name. + * The Console Command name. * * @var string */ @@ -25,7 +25,7 @@ final class PestDatasetCommand extends Command {--test-directory=tests : The name of the tests directory}'; /** - * The console command description. + * The Console Command description. * * @var string */ diff --git a/src/Laravel/PestServiceProvider.php b/src/Laravel/PestServiceProvider.php index ae3c939a..01505d33 100644 --- a/src/Laravel/PestServiceProvider.php +++ b/src/Laravel/PestServiceProvider.php @@ -14,7 +14,7 @@ use Pest\Laravel\Commands\PestTestCommand; final class PestServiceProvider extends ServiceProvider { /** - * Register artisan commands. + * Register Artisan Commands. */ public function register(): void { diff --git a/src/PendingObjects/AfterEachCall.php b/src/PendingCalls/AfterEachCall.php similarity index 82% rename from src/PendingObjects/AfterEachCall.php rename to src/PendingCalls/AfterEachCall.php index 6702dcb5..2bf0b16a 100644 --- a/src/PendingObjects/AfterEachCall.php +++ b/src/PendingCalls/AfterEachCall.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Pest\PendingObjects; +namespace Pest\PendingCalls; use Closure; use Pest\Support\Backtrace; @@ -17,21 +17,22 @@ use Pest\TestSuite; final class AfterEachCall { /** - * Holds the before each closure. + * The "afterEach" closure. */ private Closure $closure; /** - * Holds calls that should be proxied. + * The calls that should be proxied. */ private HigherOrderMessageCollection $proxies; /** - * Creates a new instance of before each call. + * Creates a new Pending Call. */ public function __construct( private TestSuite $testSuite, - private string $filename, Closure $closure = null + private string $filename, + Closure $closure = null ) { $this->closure = $closure instanceof Closure ? $closure : NullClosure::create(); @@ -39,7 +40,7 @@ final class AfterEachCall } /** - * Dispatch the creation of each call. + * Creates the Call. */ public function __destruct() { diff --git a/src/PendingObjects/BeforeEachCall.php b/src/PendingCalls/BeforeEachCall.php similarity index 89% rename from src/PendingObjects/BeforeEachCall.php rename to src/PendingCalls/BeforeEachCall.php index ff637d52..8fc5a08f 100644 --- a/src/PendingObjects/BeforeEachCall.php +++ b/src/PendingCalls/BeforeEachCall.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Pest\PendingObjects; +namespace Pest\PendingCalls; use Closure; use Pest\Support\Backtrace; @@ -22,12 +22,12 @@ final class BeforeEachCall private \Closure $closure; /** - * Holds calls that should be proxied. + * The calls that should be proxied. */ private HigherOrderMessageCollection $proxies; /** - * Creates a new instance of before each call. + * Creates a new Pending Call. */ public function __construct( private TestSuite $testSuite, @@ -40,7 +40,7 @@ final class BeforeEachCall } /** - * Dispatch the creation of each call. + * Creates the Call. */ public function __destruct() { diff --git a/src/PendingObjects/TestCall.php b/src/PendingCalls/TestCall.php similarity index 94% rename from src/PendingObjects/TestCall.php rename to src/PendingCalls/TestCall.php index 235c1750..f6c1300b 100644 --- a/src/PendingObjects/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Pest\PendingObjects; +namespace Pest\PendingCalls; use Closure; use Pest\Factories\TestCaseFactory; @@ -20,21 +20,17 @@ use SebastianBergmann\Exporter\Exporter; final class TestCall { /** - * Holds the test case factory. - * - * @readonly + * The Test Case Factory. */ private TestCaseFactory $testCaseFactory; /** * If test call is descriptionLess. - * - * @readonly */ - private bool $descriptionLess = false; + private bool $descriptionLess; /** - * Creates a new instance of a pending test call. + * Creates a new Pending Call. */ public function __construct( private TestSuite $testSuite, @@ -207,8 +203,7 @@ final class TestCall } /** - * Adds the current test case factory - * to the tests repository. + * Creates the Call. */ public function __destruct() { diff --git a/src/PendingObjects/UsesCall.php b/src/PendingCalls/UsesCall.php similarity index 96% rename from src/PendingObjects/UsesCall.php rename to src/PendingCalls/UsesCall.php index 8a954dbf..6609e8b2 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingCalls/UsesCall.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Pest\PendingObjects; +namespace Pest\PendingCalls; use Closure; use Pest\TestSuite; @@ -41,7 +41,7 @@ final class UsesCall private array $groups = []; /** - * Creates a new instance of a pending test uses. + * Creates a new Pending Call. * * @param array $classAndTraits */ @@ -135,7 +135,7 @@ final class UsesCall } /** - * Dispatch the creation of uses. + * Creates the Call. */ public function __destruct() { diff --git a/src/Plugins/Actions/AddsOutput.php b/src/Plugins/Actions/AddsOutput.php index 966affe8..967ff0a2 100644 --- a/src/Plugins/Actions/AddsOutput.php +++ b/src/Plugins/Actions/AddsOutput.php @@ -13,8 +13,7 @@ final class AddsOutput /** * Executes the Plugin action. * - * Provides an opportunity for any plugins that want - * to provide additional output after test execution. + * Provides an opportunity for any plugins that want to provide additional output after test execution. */ public function __invoke(int $exitCode): int { diff --git a/src/Plugins/Coverage.php b/src/Plugins/Coverage.php index 667c0571..8febde52 100644 --- a/src/Plugins/Coverage.php +++ b/src/Plugins/Coverage.php @@ -28,7 +28,7 @@ final class Coverage implements AddsOutput, HandlesArguments private const MIN_OPTION = 'min'; /** - * Whether should show the coverage or not. + * Whether it should show the coverage or not. */ public bool $coverage = false; diff --git a/src/Repositories/TestRepository.php b/src/Repositories/TestRepository.php index 9eafa001..40c2972b 100644 --- a/src/Repositories/TestRepository.php +++ b/src/Repositories/TestRepository.php @@ -101,7 +101,7 @@ final class TestRepository foreach ($state as $testFactory) { /** @var TestCaseFactory $testFactory */ - $tests = $testFactory->build($testSuite); + $tests = $testFactory->make($testSuite); foreach ($tests as $test) { $each($test); } diff --git a/src/TestSuite.php b/src/TestSuite.php index 94797263..0df60394 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -60,10 +60,9 @@ final class TestSuite /** * Creates a new instance of the test suite. */ - public function __construct(string $rootPath, /** - * Holds the test path. - */ - public string $testPath) + public function __construct( + string $rootPath, + public string $testPath) { $this->beforeAll = new BeforeAllRepository(); $this->beforeEach = new BeforeEachRepository(); @@ -71,7 +70,7 @@ final class TestSuite $this->afterEach = new AfterEachRepository(); $this->afterAll = new AfterAllRepository(); - $this->rootPath = (string) realpath($rootPath); + $this->rootPath = (string) realpath($rootPath); } /** diff --git a/tests/Features/PendingHigherOrderTests.php b/tests/Features/PendingHigherOrderTests.php index dbe59216..a22cf027 100644 --- a/tests/Features/PendingHigherOrderTests.php +++ b/tests/Features/PendingHigherOrderTests.php @@ -1,6 +1,6 @@