createMock(Select::class); $select->method('from')->willReturnSelf(); $select->method('where')->willReturnSelf(); $connection = $this->createMock(AdapterInterface::class); $connection->method('select')->willReturn($select); $connection->method('fetchOne')->willReturn('2'); $connection->expects(self::once()) ->method('delete') ->with('esun_localetranslation_queue') ->willReturn(18); $resourceConnection = $this->createMock(ResourceConnection::class); $resourceConnection->method('getConnection')->willReturn($connection); $resourceConnection->method('getTableName')->willReturn('esun_localetranslation_queue'); $manager = new QueueManager( $resourceConnection, $this->createMock(EntityPool::class), $this->createMock(ProviderConfig::class), $this->createMock(StoreViewProvider::class) ); self::assertSame(['deleted' => 18, 'processing' => 2], $manager->clearAll()); } }