ver. 0.290: ShopCoupon + ShopOrder frontend migration to Domain + Controllers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
43
tests/Unit/front/Controllers/ShopOrderControllerTest.php
Normal file
43
tests/Unit/front/Controllers/ShopOrderControllerTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace Tests\Unit\front\Controllers;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use front\Controllers\ShopOrderController;
|
||||
use Domain\Order\OrderRepository;
|
||||
|
||||
class ShopOrderControllerTest extends TestCase
|
||||
{
|
||||
private $repository;
|
||||
private $controller;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->repository = $this->createMock(OrderRepository::class);
|
||||
$this->controller = new ShopOrderController($this->repository);
|
||||
}
|
||||
|
||||
public function testConstructorAcceptsRepository(): void
|
||||
{
|
||||
$controller = new ShopOrderController($this->repository);
|
||||
$this->assertInstanceOf(ShopOrderController::class, $controller);
|
||||
}
|
||||
|
||||
public function testHasMainActionMethods(): void
|
||||
{
|
||||
$this->assertTrue(method_exists($this->controller, 'paymentConfirmation'));
|
||||
$this->assertTrue(method_exists($this->controller, 'paymentStatusTpay'));
|
||||
$this->assertTrue(method_exists($this->controller, 'paymentStatusPrzelewy24pl'));
|
||||
$this->assertTrue(method_exists($this->controller, 'paymentStatusHotpay'));
|
||||
$this->assertTrue(method_exists($this->controller, 'orderDetails'));
|
||||
}
|
||||
|
||||
public function testConstructorRequiresOrderRepository(): void
|
||||
{
|
||||
$reflection = new \ReflectionClass(ShopOrderController::class);
|
||||
$constructor = $reflection->getConstructor();
|
||||
$params = $constructor->getParameters();
|
||||
|
||||
$this->assertCount(1, $params);
|
||||
$this->assertEquals('Domain\Order\OrderRepository', $params[0]->getType()->getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user