/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/MessageQueue/Test/Unit/MessageControllerTest.php
69 строк
2 KB
Raj Mohan R
AC-16248: PHPUnit 12 Upgrade | Fix Skipped Unit Tests
29 янв 2026, 16:25
29 янв 2026, 16:25
9a77384
Код
Авторство
О чём код?
<?php /** * Copyright 2018 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Framework\MessageQueue\Test\Unit; use Magento\Framework\Exception\NotFoundException; use Magento\Framework\MessageQueue\EnvelopeInterface; use Magento\Framework\MessageQueue\LockInterfaceFactory; use Magento\Framework\MessageQueue\MessageController; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * Unit test for MessageController class. * */ class MessageControllerTest extends TestCase { /** * @var LockInterfaceFactory|MockObject */ private $lockFactory; /** * @var MessageController */ private $messageController; /** * Set up. * * @return void */ protected function setUp(): void { $this->lockFactory = $this->createMock(LockInterfaceFactory::class); $objectManager = new ObjectManager($this); $this->messageController = $objectManager->getObject( MessageController::class, [ 'lockFactory' => $this->lockFactory ] ); } /** * Test for lock method with NotFoundException. * * @return void */ public function testLockWithNotFoundException() { $properties = []; $consumerName = ''; $this->expectException(NotFoundException::class); $this->expectExceptionMessage("Property 'message_id' not found in properties."); $this->lockFactory->expects($this->once())->method('create'); $envelope = $this->createMock(EnvelopeInterface::class); $envelope->expects($this->once())->method('getProperties')->willReturn($properties); $this->messageController->lock($envelope, $consumerName); } }