Skip to content

Commit

Permalink
Format code by the latest cs-fixer. (#6617)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo authored Mar 23, 2024
1 parent 962501e commit 465cbb4
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use ArrayAccess;
Expand Down
1 change: 1 addition & 0 deletions src/AssertableJsonString.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use ArrayAccess;
Expand Down
1 change: 1 addition & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use Hyperf\Codec\Packer\JsonPacker;
Expand Down
13 changes: 8 additions & 5 deletions src/Concerns/InteractsWithContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Concerns;

use Closure;
use Hyperf\Context\ApplicationContext;
use Hyperf\Contract\ApplicationInterface;
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSourceFactory;
use Mockery;
use Mockery\MockInterface;
use Psr\Container\ContainerInterface;

trait InteractsWithContainer
{
/**
* @var null|ContainerInterface|\Hyperf\Di\Container
* @var null|Container|ContainerInterface
*/
protected ?ContainerInterface $container = null;

Expand Down Expand Up @@ -56,7 +59,7 @@ protected function instance($abstract, $instance)
* Mock an instance of an object in the container.
*
* @param string $abstract
* @return \Mockery\MockInterface
* @return MockInterface
*/
protected function mock($abstract, ?Closure $mock = null)
{
Expand All @@ -67,7 +70,7 @@ protected function mock($abstract, ?Closure $mock = null)
* Mock a partial instance of an object in the container.
*
* @param string $abstract
* @return \Mockery\MockInterface
* @return MockInterface
*/
protected function partialMock($abstract, ?Closure $mock = null)
{
Expand All @@ -78,7 +81,7 @@ protected function partialMock($abstract, ?Closure $mock = null)
* Spy an instance of an object in the container.
*
* @param string $abstract
* @return \Mockery\MockInterface
* @return MockInterface
*/
protected function spy($abstract, ?Closure $mock = null)
{
Expand Down Expand Up @@ -108,6 +111,6 @@ protected function setContainer(ContainerInterface $container): void
protected function refreshContainer(): void
{
$this->container = ApplicationContext::setContainer($this->createContainer());
$this->container->get(\Hyperf\Contract\ApplicationInterface::class);
$this->container->get(ApplicationInterface::class);
}
}
1 change: 1 addition & 0 deletions src/Concerns/InteractsWithDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Concerns;

use Hyperf\Context\ApplicationContext;
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/InteractsWithModelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Concerns;

use Faker\Factory as FakerFactory;
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Concerns;

use Hyperf\Testing\Http\Client;
Expand Down
11 changes: 8 additions & 3 deletions src/Concerns/RunTestsInCoroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Concerns;

use Hyperf\Coordinator\Constants;
use Hyperf\Coordinator\CoordinatorManager;
use Swoole\Coroutine;
use Swoole\Timer;
use Throwable;

/**
Expand All @@ -36,8 +41,8 @@ final protected function runTestsInCoroutine(...$arguments)
} catch (Throwable $e) {
$exception = $e;
} finally {
\Swoole\Timer::clearAll();
\Hyperf\Coordinator\CoordinatorManager::until(\Hyperf\Coordinator\Constants::WORKER_EXIT)->resume();
Timer::clearAll();
CoordinatorManager::until(Constants::WORKER_EXIT)->resume();
}
});

Expand All @@ -50,7 +55,7 @@ final protected function runTestsInCoroutine(...$arguments)

final protected function runTest(): mixed
{
if (extension_loaded('swoole') && \Swoole\Coroutine::getCid() === -1 && $this->enableCoroutine) {
if (extension_loaded('swoole') && Coroutine::getCid() === -1 && $this->enableCoroutine) {
$this->realTestName = $this->name();
parent::setName('runTestsInCoroutine');
}
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/ArraySubset.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Constraint;

use ArrayObject;
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/HasInDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Constraint;

use Hyperf\Database\ConnectionInterface;
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/SeeInOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Constraint;

use PHPUnit\Framework\Constraint\Constraint;
Expand Down
1 change: 1 addition & 0 deletions src/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

class Debug
Expand Down
1 change: 1 addition & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Exception;

use PHPUnit\Framework\Exception;
Expand Down
1 change: 1 addition & 0 deletions src/Fluent/AssertableJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Fluent;

use Closure;
Expand Down
1 change: 1 addition & 0 deletions src/Fluent/Concerns/Debugging.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Fluent\Concerns;

trait Debugging
Expand Down
1 change: 1 addition & 0 deletions src/Fluent/Concerns/Has.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Fluent\Concerns;

use Closure;
Expand Down
1 change: 1 addition & 0 deletions src/Fluent/Concerns/Interaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Fluent\Concerns;

use Hyperf\Stringable\Str;
Expand Down
1 change: 1 addition & 0 deletions src/Fluent/Concerns/Matching.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Fluent\Concerns;

use Closure;
Expand Down
1 change: 1 addition & 0 deletions src/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Http;

use Hyperf\Collection\Arr;
Expand Down
1 change: 1 addition & 0 deletions src/Http/Concerns/AssertsStatusCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Http\Concerns;

use PHPUnit\Framework\Assert as PHPUnit;
Expand Down
1 change: 1 addition & 0 deletions src/Http/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\Http;

use ArrayAccess;
Expand Down
1 change: 1 addition & 0 deletions src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use GuzzleHttp\Client;
Expand Down
1 change: 1 addition & 0 deletions src/HttpMessage/Upload/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing\HttpMessage\Upload;

class UploadedFile extends \Hyperf\HttpMessage\Upload\UploadedFile
Expand Down
1 change: 1 addition & 0 deletions src/ModelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use Faker\Generator;
Expand Down
1 change: 1 addition & 0 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Testing;

use Mockery as m;
Expand Down
1 change: 1 addition & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Testing;

use Hyperf\Codec\Json;
Expand Down
1 change: 1 addition & 0 deletions tests/DebugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Testing;

use Hyperf\Testing\Debug;
Expand Down
4 changes: 3 additions & 1 deletion tests/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace tests;

use Hyperf\Testing\HttpClient;
use Mockery;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;

Expand All @@ -31,7 +33,7 @@ protected function tearDown(): void
Mockery::close();
}

#[\PHPUnit\Framework\Attributes\Group('NonCoroutine')]
#[Group('NonCoroutine')]
public function testJsonRequest()
{
run(function () {
Expand Down
1 change: 1 addition & 0 deletions tests/Stub/Exception/Handler/FooExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Testing\Stub\Exception\Handler;

use Hyperf\ExceptionHandler\ExceptionHandler;
Expand Down
1 change: 1 addition & 0 deletions tests/Stub/FooController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Testing\Stub;

use Hyperf\Context\Context;
Expand Down

0 comments on commit 465cbb4

Please sign in to comment.