Enables integration

This commit is contained in:
Nuno Maduro
2022-09-15 12:07:32 +01:00
parent 99e607dcfb
commit 46ffdf9c7a
9 changed files with 134 additions and 80 deletions

14
TODO.md
View File

@ -1,7 +1,7 @@
1. Support for `--help` pest options.
2. Support for `default` printer.
3. Support for `TeamCity` printer.
4. Support for `JUnit` log.
5. Plugins
6. Parallel
7. Collision's todo...
1. TeamCity
2. Junit
3. Help display
4. Thanks display
5. Check all plugins
6. Parallel testing.
7. Finish Collision's todo

View File

@ -45,8 +45,8 @@
]
},
"require-dev": {
"illuminate/console": "^9.29",
"illuminate/support": "^9.29",
"illuminate/console": "^9.30",
"illuminate/support": "^9.30",
"laravel/dusk": "^6.25.1",
"pestphp/pest-dev-tools": "dev-master"
},
@ -68,12 +68,13 @@
"test:types": "phpstan analyse --ansi --memory-limit=-1 --debug",
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
"test:parallel": "exit 1",
"test:integration": "exit 1",
"update:snapshots": "exit 1",
"test:integration": "php bin/pest --colors=always --group=integration",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always",
"test": [
"@test:lint",
"@test:types",
"@test:unit"
"@test:unit",
"@test:integration"
]
},
"extra": {

View File

@ -45,7 +45,7 @@ use function class_exists;
use function get_declared_classes;
use Pest\Contracts\HasPrintableTestCaseName;
use Pest\TestCases\IgnorableTestCase;
use Pest\TestCases\IgnorableTest;
use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
@ -178,6 +178,6 @@ final class TestSuiteLoader
private function exceptionFor(string $className, string $filename): ReflectionClass
{
return new ReflectionClass(IgnorableTestCase::class);
return new ReflectionClass(IgnorableTest::class);
}
}

View File

@ -7,7 +7,7 @@
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
failOnRisky="true"
failOnRisky="false"
failOnWarning="true"
processIsolation="false"
stopOnError="false"

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Pest\TestCases;
use PHPUnit\Framework\TestCase;
/**
* @internal
*/
final class IgnorableTest extends TestCase
{
/**
* Creates a dummy assertion.
*/
public function testIgnorable(): void
{
self::assertTrue(true);
}
}

View File

@ -1,16 +0,0 @@
<?php
declare(strict_types=1);
namespace Pest\TestCases;
use PHPUnit\Framework\TestCase;
/**
* @internal
* @phpstan-ignore-next-line
*/
class IgnorableTestCase extends TestCase
{
// ..
}

View File

@ -1,7 +1,4 @@
PASS Tests\CustomTestCase\ExecutedTest
✓ that gets executed
PASS Tests\Features\AfterAll
✓ deletes file after all
@ -23,6 +20,15 @@
✓ it adds coverage if --min exist
✓ it generates coverage based on file input
PASS Tests\Features\Covers
✓ it uses the correct PHPUnit attribute for class
✓ it uses the correct PHPUnit attribute for function
✓ it removes duplicated attributes
✓ it guesses if the given argument is a class or function
✓ it appends CoversNothing to method attributes
✓ it does not append CoversNothing to other methods
✓ it throws exception if no class nor method has been found
PASS Tests\Features\Datasets
✓ it throws exception if dataset does not exist
✓ it throws exception if dataset already exist
@ -96,22 +102,50 @@
✓ more than two datasets with (2) / (4) / (5)
✓ more than two datasets with (2) / (4) / (6)
✓ more than two datasets did the job right
✓ it can resolve a dataset after the test case is available with (Closure Object (...))
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #1
✓ it can resolve a dataset after the test case is available with (Closure Object (...)) #2
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2
✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #1
✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #2
✓ it resolves a potential bound dataset logically with ('foo', Closure Object (...))
✓ it resolves a potential bound dataset logically even when the closure comes first with (Closure Object (...), 'bar')
✓ it will not resolve a closure if it is type hinted as a closure with (Closure Object (...)) #1
✓ it will not resolve a closure if it is type hinted as a closure with (Closure Object (...)) #2
✓ it will not resolve a closure if it is type hinted as a callable with (Closure Object (...)) #1
✓ it will not resolve a closure if it is type hinted as a callable with (Closure Object (...)) #2
✓ it can correctly resolve a bound dataset that returns an array with (Closure Object (...))
✓ it can correctly resolve a bound dataset that returns an array but wants to be spread with (Closure Object (...))
PASS Tests\Features\Depends
✓ first
✓ second
✓ depends
✓ depends with ...params
✓ depends with defined arguments
✓ depends run test only once
✓ it asserts true is true
✓ depends works with the correct test name
PASS Tests\Features\DependsInheritance
✓ it is a test
✓ it uses correct parent class
PASS Tests\Features\Exceptions
✓ it gives access the the underlying expectException
✓ it catch exceptions
✓ it catch exceptions and messages
✓ it catch exceptions, messages and code
✓ it can just define the message
✓ it can just define the code
✓ it not catch exceptions if given condition is false
✓ it catch exceptions if given condition is true
✓ it catch exceptions and messages if given condition is true
✓ it catch exceptions, messages and code if given condition is true
✓ it can just define the message if given condition is true
✓ it can just define the code if given condition is true
✓ it can just define the message if given condition is 1
✓ it can just define the code if given condition is 1
PASS Tests\Features\Expect\HigherOrder\methods
✓ it can access methods
@ -124,6 +158,8 @@
✓ it can compose complex expectations
✓ it can handle nested method calls
✓ it works with higher order tests
✓ it can use the scoped method to lock into the given level for expectations
✓ it works consistently with the json expectation method
PASS Tests\Features\Expect\HigherOrder\methodsAndProperties
✓ it can access methods and properties
@ -131,6 +167,7 @@
✓ it works with higher order tests
✓ it can start a new higher order expectation using the and syntax
✓ it can start a new higher order expectation using the and syntax in higher order tests
✓ it can start a new higher order expectation using the and syntax without nesting expectations
PASS Tests\Features\Expect\HigherOrder\properties
✓ it allows properties to be accessed from the value
@ -152,6 +189,7 @@
✓ chained opposite and non-opposite expectations
✓ it can add expectations via "and"
✓ it accepts callables
✓ it passes the key of the current item to callables
PASS Tests\Features\Expect\extend
✓ it macros true is true
@ -177,6 +215,18 @@
PASS Tests\Features\Expect\not
✓ not property calls
PASS Tests\Features\Expect\pipes
✓ pipe is applied and can stop pipeline
✓ pipe is run and can let the pipeline keep going
✓ pipe works with negated expectation
✓ interceptor is applied
✓ interceptor stops the pipeline
✓ interceptor is called only when filter is met
✓ interceptor can be filtered with a closure
✓ interceptor can be filter the expected parameter as well
✓ interceptor works with negated expectation
✓ intercept can add new parameters to the expectation
PASS Tests\Features\Expect\ray
✓ ray calls do not fail when ray is not installed
@ -385,6 +435,11 @@
✓ not failures with multiple needles (all failing)
✓ not failures with multiple needles (some failing)
PASS Tests\Features\Expect\toContainOnlyInstancesOf
✓ pass
✓ failures
✓ not failures
PASS Tests\Features\Expect\toEndWith
✓ pass
✓ failures
@ -432,8 +487,11 @@
PASS Tests\Features\Expect\toHaveKeys
✓ pass
✓ pass with multi-dimensional arrays
✓ failures
✓ failures with multi-dimensional arrays
✓ not failures
✓ not failures with multi-dimensional arrays
PASS Tests\Features\Expect\toHaveLength
✓ it passes with ('Fortaleza')
@ -476,6 +534,7 @@
PASS Tests\Features\Expect\toMatchObject
✓ pass
✓ pass with class
✓ failures
✓ not failures
@ -530,9 +589,9 @@
✓ it is capable doing multiple assertions
✓ it resolves expect callables correctly
✓ does not treat method names as callables
✓ it can tap into the test
✓ it can defer a method until after test setup
✓ it can pass datasets into the expect callables with (1, 2, 3)
✓ it can pass datasets into the tap callable with (1, 2, 3)
✓ it can pass datasets into the defer callable with (1, 2, 3)
✓ it can pass shared datasets into callables with (1)
✓ it can pass shared datasets into callables with (2)
@ -560,7 +619,7 @@
WARN Tests\Features\Skip
✓ it do not skips
- it skips with truthy
- it skips with truthy → 1
- it skips with truthy condition by default
- it skips with message → skipped because bar
- it skips with truthy closure condition
@ -574,6 +633,10 @@
✓ a test
✓ higher order message test
PASS Tests\Features\ThrowsNoExceptions
✓ it allows access to the underlying expectNotToPerformAssertions method
✓ it allows performing no expectations without being risky
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
✓ it example 1
@ -600,14 +663,14 @@
PASS Tests\PHPUnit\CustomAffixes\ATestWithSpaces
✓ it runs file names like `A Test With Spaces.php`
PASS Tests\PHPUnit\CustomAffixes\AdditionalFileExtensionspec
PASS Tests\PHPUnit\CustomAffixes\AdditionalFileExtension
✓ it runs file names like `AdditionalFileExtension.spec.php`
PASS Tests\PHPUnit\CustomAffixes\FolderWithAn\ExampleTest
✓ custom traits can be used
✓ trait applied in this file
PASS Tests\PHPUnit\CustomAffixes\ManyExtensionsclasstest
PASS Tests\PHPUnit\CustomAffixes\ManyExtensions
✓ it runs file names like `ManyExtensions.class.test.php`
PASS Tests\PHPUnit\CustomAffixes\TestCaseWithQuotes
@ -629,25 +692,21 @@
✓ custom traits can be used
✓ trait applied in this file
PASS Tests\Playground
basic
WARN Tests\Playground
! basic → This test did not perform any assertions
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
it does not override options
PASS Tests\Unit\Actions\AddsTests
✓ default php unit tests
it removes warnings
PASS Tests\Unit\Actions\ValidatesConfiguration
✓ it throws exception when configuration not found
✓ it throws exception when `process isolation` is true
✓ it do not throws exception when `process isolation` is false
WARN Tests\Unit\ConfigLoader
✓ it fallbacks to default path if no phpunit file is found
- it fallbacks to default path if phpunit is not a valid XML
- it fallbacks to default path if failing to read phpunit content
- it fallbacks to default path if there is no test suites directory
- it fallbacks to default path if test suite directory has no value
- it fallbacks to default path if test suite directory does not exist
- it returns the parent folder of first test suite directory
PASS Tests\Unit\Console\Help
✓ it outputs the help information when --help is used
@ -663,6 +722,9 @@
✓ environment is set to CI when --ci option is used
✓ environment is set to Local when --ci option is not used
PASS Tests\Unit\Plugins\Retry
✓ it retries if --retry argument is used
PASS Tests\Unit\Plugins\Version
✓ it outputs the version when --version is used
✓ it do not outputs version when --version is not used
@ -690,11 +752,11 @@
✓ it can filter the test suite filenames to those with the only method
✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline
PASS Tests\Visual\Help
visual snapshot of help command output
WARN Tests\Visual\Help
- visual snapshot of help command output → Not supported yet.
PASS Tests\Visual\JUnit
it is can successfully call all public methods
WARN Tests\Visual\JUnit
- it is can successfully call all public methods → Not supported yet.
PASS Tests\Visual\SingleTestOrDirectory
✓ allows to run a single test
@ -705,22 +767,8 @@
WARN Tests\Visual\Success
- visual snapshot of test suite on success
PASS Tests\Visual\TeamCity
it is can successfully call all public methods
WARN Tests\Visual\TeamCity
- it is can successfully call all public methods → Not supported yet.
PASS Tests\Features\Depends
✓ first
✓ second
✓ it asserts true is true
✓ depends
✓ depends with ...params
✓ depends with defined arguments
✓ depends run test only once
✓ depends works with the correct test name
PASS Tests\Features\DependsInheritance
✓ it is a test
✓ it uses correct parent class
Tests: 4 incompleted, 9 skipped, 480 passed
Tests: 1 risky, 4 incompleted, 18 skipped, 514 passed

View File

@ -1,5 +1,5 @@
<?php
test('basic', function () {
expect(true)->toBeTrue();
// ..
});

View File

@ -3,7 +3,7 @@
use Symfony\Component\Process\Process;
$run = function (string $target, $decorated = false) {
$process = new Process(['php', 'bin/pest', $target], dirname(__DIR__, 2));
$process = new Process(['php', 'bin/pest', $target, '--colors=always'], dirname(__DIR__, 2));
$process->run();