add integration tests for Admin User and Admin Order controllers

This commit is contained in:
Daniel Seifert 2023-01-13 11:54:03 +01:00
parent 653b75c164
commit ea3489eaf3
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
4 changed files with 911 additions and 1 deletions

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace D3\Linkmobility4OXID\Application\Model\MessageTypes;
use D3\LinkmobilityClient\RecipientsList\RecipientsList;
use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface;
use D3\LinkmobilityClient\Response\ResponseInterface;
use D3\LinkmobilityClient\ValueObject\Recipient;

View File

@ -0,0 +1,84 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\Linkmobility4OXID\tests\integration;
use D3\Linkmobility4OXID\Application\Model\MessageClient;
use D3\Linkmobility4OXID\tests\unit\LMUnitTestCase;
use D3\LinkmobilityClient\Client;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Query\QueryBuilder;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use OxidEsales\Eshop\Application\Model\Remark;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
abstract class LMIntegrationTestCase extends LMUnitTestCase
{
/**
* @param $userId
*
* @throws Exception
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function deleteAllRemarksFrom($userId)
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->delete(oxNew(Remark::class)->getCoreTableName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($userId)
)
);
$queryBuilder->execute();
}
/**
* @param ResponseInterface|RequestException $response
*/
protected function setClientResponse($response, callable $history = null)
{
$handlerMock = new MockHandler([$response]);
$handlerStack = HandlerStack::create($handlerMock);
if ($history) {
$handlerStack->push($history);
}
$guzzleMock = new GuzzleClient(['handler' => $handlerStack]);
/** @var Client $LMClient */
$LMClient = oxNew(Client::class, 'accessToken', null, $guzzleMock);
/** @var MessageClient|MockObject $messageClientMock */
$messageClientMock = $this->getMockBuilder(MessageClient::class)
->onlyMethods(['getClient'])
->getMock();
$messageClientMock->method('getClient')->willReturn($LMClient);
d3GetOxidDIC()->set(MessageClient::class, $messageClientMock);
}
}

View File

@ -0,0 +1,418 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\Linkmobility4OXID\tests\integration;
use D3\Linkmobility4OXID\Application\Controller\Admin\AdminOrder;
use D3\Linkmobility4OXID\Application\Model\Configuration;
use Doctrine\DBAL\Query\QueryBuilder;
use Exception;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Remark;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\RequestInterface;
class adminOrderTest extends LMIntegrationTestCase
{
/** @var Order */
protected $order;
protected $userId = 'testUserId';
protected $orderId = 'testOrderId';
public function setUp(): void
{
parent::setUp();
/** @var Configuration|MockObject $configuration */
$configuration = $this->getMockBuilder(Configuration::class)
->onlyMethods(['getTestMode'])
->getMock();
$configuration->method('getTestMode')->willReturn(true);
d3GetOxidDIC()->set(Configuration::class, $configuration);
/** @var User $order */
$this->order = $order = oxNew( Order::class);
$order->setId($this->orderId);
$order->assign([
'oxbillfon' => '01512 3456789',
'oxbillcountryid' => 'a7c40f631fc920687.20179984',
'oxuserid' => $this->userId
]);
$order->save();
/** @var User $user */
$this->user = $user = oxNew(User::class);
$user->setId($this->userId);
$user->save();
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function succSending()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
['X-Foo' => 'Bar'],
'{"statusCode":2000,"statusMessage":"OK","clientMessageId":null,"transferId":"0063c11b0100eeda5a1d","smsCount":1}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->orderId;
/** @var AdminOrder $controller */
$controller = oxNew(AdminOrder::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
1
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) > 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function apiError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
[],
'{"statusCode": 4019, "statusMessage": "parameter \"messageContent\" invalid", "clientMessageId": null, "transferId": null, "smsCount": 0}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->orderId;
/** @var AdminOrder $controller */
$controller = oxNew(AdminOrder::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'parameter "messageContent" invalid'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function emptyMessage()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
[],
'{"statusCode": 4019, "statusMessage": "parameter \"messageContent\" invalid", "clientMessageId": null, "transferId": null, "smsCount": 0}'
),
$history
);
$_POST['messagebody'] = '';
$_POST['oxid'] = $this->orderId;
/** @var AdminOrder $controller */
$controller = oxNew(AdminOrder::class);
$controller->send();
// check requests
$this->assertCount(
0, // no request because of internal handling
$container
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_NO_LENGTH'),
1
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function recipientError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
['X-Foo' => 'Bar'],
'{"statusCode":2000,"statusMessage":"OK","clientMessageId":null,"transferId":"0063c11b0100eeda5a1d","smsCount":1}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->orderId;
$this->order->assign( [
'oxbillfon' => '',
'oxbillcountryid' => ''
]);
$this->order->save();
/** @var AdminOrder $controller */
$controller = oxNew(AdminOrder::class);
$controller->send();
// check requests
$this->assertCount(
0, // no request because of internal handling
$container
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'no response'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function communicationError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new RequestException(
'Error Communicating with Server',
new Request('GET', 'test')
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->orderId;
/** @var AdminOrder $controller */
$controller = oxNew(AdminOrder::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'no response'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @throws Exception
*/
public function tearDown(): void
{
parent::tearDown();
$this->order->delete();
$this->user->delete();
}
}

View File

@ -0,0 +1,409 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\Linkmobility4OXID\tests\integration;
use D3\Linkmobility4OXID\Application\Model\Configuration;
use \D3\Linkmobility4OXID\Application\Controller\Admin\AdminUser;
use Doctrine\DBAL\Query\QueryBuilder;
use Exception;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use OxidEsales\Eshop\Application\Model\Remark;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\RequestInterface;
class adminUserTest extends LMIntegrationTestCase
{
/** @var User */
protected $user;
protected $userId = 'testUserId';
public function setUp(): void
{
parent::setUp();
/** @var Configuration|MockObject $configuration */
$configuration = $this->getMockBuilder(Configuration::class)
->onlyMethods(['getTestMode'])
->getMock();
$configuration->method('getTestMode')->willReturn(true);
d3GetOxidDIC()->set(Configuration::class, $configuration);
/** @var User $user */
$this->user = $user = oxNew(User::class);
$user->setId($this->userId);
$user->assign([
'oxfon' => '01512 3456789',
'oxcountryid' => 'a7c40f631fc920687.20179984'
]);
$user->save();
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function succSending()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
['X-Foo' => 'Bar'],
'{"statusCode":2000,"statusMessage":"OK","clientMessageId":null,"transferId":"0063c11b0100eeda5a1d","smsCount":1}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->userId;
/** @var AdminUser $controller */
$controller = oxNew(AdminUser::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_SMS_SUCC_SENT'),
1
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) > 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function apiError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
[],
'{"statusCode": 4019, "statusMessage": "parameter \"messageContent\" invalid", "clientMessageId": null, "transferId": null, "smsCount": 0}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->userId;
/** @var AdminUser $controller */
$controller = oxNew(AdminUser::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'parameter "messageContent" invalid'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function emptyMessage()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
[],
'{"statusCode": 4019, "statusMessage": "parameter \"messageContent\" invalid", "clientMessageId": null, "transferId": null, "smsCount": 0}'
),
$history
);
$_POST['messagebody'] = '';
$_POST['oxid'] = $this->userId;
/** @var AdminUser $controller */
$controller = oxNew(AdminUser::class);
$controller->send();
// check requests
$this->assertCount(
0, // no request because of internal handling
$container
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_NO_LENGTH'),
1
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function recipientError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new Response(
200,
['X-Foo' => 'Bar'],
'{"statusCode":2000,"statusMessage":"OK","clientMessageId":null,"transferId":"0063c11b0100eeda5a1d","smsCount":1}'
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->userId;
$this->user->assign([
'oxfon' => '',
'oxcountryid' => ''
]);
$this->user->save();
/** @var AdminUser $controller */
$controller = oxNew(AdminUser::class);
$controller->send();
// check requests
$this->assertCount(
0, // no request because of internal handling
$container
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'no response'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @test
* @throws \Doctrine\DBAL\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function communicationError()
{
$container = [];
$history = Middleware::history($container);
$this->deleteAllRemarksFrom($this->userId);
$this->setClientResponse(
new RequestException(
'Error Communicating with Server',
new Request('GET', 'test')
),
$history
);
$_POST['messagebody'] = 'testMessage';
$_POST['oxid'] = $this->userId;
/** @var AdminUser $controller */
$controller = oxNew(AdminUser::class);
$controller->send();
// check requests
$this->assertCount(
1,
$container
);
/** @var RequestInterface $request */
$request = $container[0]['request'];
$this->assertTrue(
(bool) strpos(serialize($request->getBody()->getContents()), 'testMessage')
);
// check return message
$search = sprintf(
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND'),
'no response'
);
$this->assertTrue(
(bool) strpos(serialize(Registry::getSession()->getVariable('Errors')), $search)
);
// check remark
/** @var QueryBuilder $queryBuilder */
$queryBuilder = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
$queryBuilder->select('oxid')
->from(oxNew(Remark::class)->getViewName())
->where(
$queryBuilder->expr()->eq(
'oxparentid',
$queryBuilder->createNamedParameter($this->userId)
)
);
$remarkIds = $queryBuilder->execute()->fetchAll();
$this->assertTrue(
count($remarkIds) == 0
);
$this->deleteAllRemarksFrom($this->userId);
}
/**
* @throws Exception
*/
public function tearDown(): void
{
parent::tearDown();
$this->user->delete();
}
}