Skip to content

Commit

Permalink
Extract stubs to separate namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Nov 11, 2024
1 parent addfd5e commit 808bc5a
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 22 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
},
"autoload": {
"psr-4": {
"Yiisoft\\Queue\\": "src"
"Yiisoft\\Queue\\": "src",
"Yiisoft\\Queue\\Stubs\\": "stubs"
}
},
"autoload-dev": {
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/StubAdapter.php → stubs/StubAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Queue\Adapter;
namespace Yiisoft\Queue\Stubs;

use Yiisoft\Queue\Adapter\AdapterInterface;
use Yiisoft\Queue\Enum\JobStatus;
use Yiisoft\Queue\Message\MessageInterface;

Expand Down
4 changes: 3 additions & 1 deletion src/Cli/StubLoop.php → stubs/StubLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Queue\Cli;
namespace Yiisoft\Queue\Stubs;

use Yiisoft\Queue\Cli\LoopInterface;

/**
* Stub loop.
Expand Down
3 changes: 2 additions & 1 deletion src/StubQueue.php → stubs/StubQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

declare(strict_types=1);

namespace Yiisoft\Queue;
namespace Yiisoft\Queue\Stubs;

use Yiisoft\Queue\Adapter\AdapterInterface;
use Yiisoft\Queue\Enum\JobStatus;
use Yiisoft\Queue\Message\MessageInterface;
use Yiisoft\Queue\Middleware\Push\MiddlewarePushInterface;
use Yiisoft\Queue\QueueInterface;

/**
* Stub queue that does nothing. Job status is always "done".
Expand Down
3 changes: 2 additions & 1 deletion src/Worker/StubWorker.php → stubs/StubWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Queue\Worker;
namespace Yiisoft\Queue\Stubs;

use Yiisoft\Queue\Message\MessageInterface;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Worker\WorkerInterface;

/**
* Stub worker that does nothing.
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Provider/AdapterFactoryQueueProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Adapter\AdapterInterface;
use Yiisoft\Queue\Adapter\StubAdapter;
use Yiisoft\Queue\Cli\StubLoop;
use Yiisoft\Queue\Stubs\StubLoop;
use Yiisoft\Queue\Provider\AdapterFactoryQueueProvider;
use Yiisoft\Queue\Provider\ChannelNotFoundException;
use Yiisoft\Queue\Provider\InvalidQueueConfigException;
use Yiisoft\Queue\StubQueue;
use Yiisoft\Queue\Stubs\StubQueue;
use Yiisoft\Queue\Stubs\StubAdapter;

use function sprintf;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Provider/CompositeQueueProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Yiisoft\Queue\Provider\ChannelNotFoundException;
use Yiisoft\Queue\Provider\CompositeQueueProvider;
use Yiisoft\Queue\Provider\QueueFactoryQueueProvider;
use Yiisoft\Queue\StubQueue;
use Yiisoft\Queue\Stubs\StubQueue;
use Yiisoft\Queue\Tests\TestCase;

final class CompositeQueueProviderTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Provider/PrototypeQueueProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Provider\PrototypeQueueProvider;
use Yiisoft\Queue\StubQueue;
use Yiisoft\Queue\Stubs\StubQueue;

final class PrototypeQueueProviderTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Provider/QueueFactoryQueueProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace Yiisoft\Queue\Tests\Unit\Provider;

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Cli\StubLoop;
use Yiisoft\Queue\Stubs\StubLoop;
use Yiisoft\Queue\Provider\ChannelNotFoundException;
use Yiisoft\Queue\Provider\QueueFactoryQueueProvider;
use Yiisoft\Queue\Provider\InvalidQueueConfigException;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\StubQueue;
use Yiisoft\Queue\Stubs\StubQueue;

use function sprintf;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Queue\Tests\Unit\Adapter;
namespace Yiisoft\Queue\Tests\Unit\Stubs;

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Adapter\StubAdapter;
use Yiisoft\Queue\Message\Message;
use Yiisoft\Queue\Stubs\StubAdapter;

final class StubAdapterTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Cli;
namespace Yiisoft\Queue\Tests\Unit\Stubs;

use PHPUnit\Framework\Attributes\DataProvider;
use Yiisoft\Queue\Cli\StubLoop;
use Yiisoft\Queue\Stubs\StubLoop;
use Yiisoft\Queue\Tests\TestCase;

final class StubLoopTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

declare(strict_types=1);

namespace Yiisoft\Queue\Tests\Unit;
namespace Yiisoft\Queue\Tests\Unit\Stubs;

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Adapter\StubAdapter;
use Yiisoft\Queue\Message\Message;
use Yiisoft\Queue\Queue;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\StubQueue;
use Yiisoft\Queue\Stubs\StubQueue;
use Yiisoft\Queue\Stubs\StubAdapter;

final class StubQueueTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Worker;
namespace Yiisoft\Queue\Tests\Unit\Stubs;

use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Message\Message;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Worker\StubWorker;
use Yiisoft\Queue\Stubs\StubWorker;

final class StubWorkerTest extends TestCase
{
Expand Down

0 comments on commit 808bc5a

Please sign in to comment.