Skip to content

Commit 8099a33

Browse files
committed
MC-42313: Some of the preg_match function calls fails on PHP 7.3 installed on Redhat/CentOS
1 parent e585f82 commit 8099a33

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Api\Test\Unit;
9+
10+
use Magento\Framework\Api\ObjectFactory;
11+
use PHPUnit\Framework\MockObject\MockObject;
12+
use PHPUnit\Framework\TestCase;
13+
14+
class AbstractSimpleObjectBuilderTest extends TestCase
15+
{
16+
/**
17+
* @var MockObject|ObjectFactory
18+
*/
19+
private $objectFactoryMock;
20+
21+
/**
22+
* @var StubAbstractSimpleObjectBuilder
23+
*/
24+
private $stubSimpleObjectBuilder;
25+
26+
protected function setUp(): void
27+
{
28+
$this->objectFactoryMock = $this->createMock(ObjectFactory::class);
29+
$this->stubSimpleObjectBuilder = new StubAbstractSimpleObjectBuilder($this->objectFactoryMock);
30+
}
31+
32+
public function testCreate()
33+
{
34+
$stubSimpleObjectMock = $this->createMock(StubAbstractSimpleObject::class);
35+
$this->objectFactoryMock->expects($this->once())
36+
->method('create')
37+
->with(StubAbstractSimpleObject::class, ['data' => []])
38+
->willReturn($stubSimpleObjectMock);
39+
$object = $this->stubSimpleObjectBuilder->create();
40+
$this->assertInstanceOf(StubAbstractSimpleObject::class, $object);
41+
}
42+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Api\Test\Unit;
9+
10+
use Magento\Framework\Api\AbstractSimpleObjectBuilder;
11+
12+
class StubAbstractSimpleObjectBuilder extends AbstractSimpleObjectBuilder
13+
{
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Api\Test\Unit\StubAbstractSimpleObjectBuilder;
9+
10+
class Interceptor extends \Magento\Framework\Api\Test\Unit\StubAbstractSimpleObjectBuilder
11+
{
12+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Api\Test\Unit\StubAbstractSimpleObjectBuilder;
9+
10+
use Magento\Framework\Api\ObjectFactory;
11+
use Magento\Framework\Api\Test\Unit\StubAbstractSimpleObject;
12+
use Magento\Framework\Api\Test\Unit\StubAbstractSimpleObjectBuilder;
13+
use PHPUnit\Framework\MockObject\MockObject;
14+
use PHPUnit\Framework\TestCase;
15+
16+
class InterceptorTest extends TestCase
17+
{
18+
/**
19+
* @var MockObject|ObjectFactory
20+
*/
21+
private $objectFactoryMock;
22+
23+
/**
24+
* @var StubAbstractSimpleObjectBuilder
25+
*/
26+
private $stubSimpleObjectBuilderInterceptor;
27+
28+
protected function setUp(): void
29+
{
30+
$this->objectFactoryMock = $this->createMock(ObjectFactory::class);
31+
$this->stubSimpleObjectBuilderInterceptor = new Interceptor($this->objectFactoryMock);
32+
}
33+
34+
public function testCreate()
35+
{
36+
$stubSimpleObjectMock = $this->createMock(StubAbstractSimpleObject::class);
37+
$this->objectFactoryMock->expects($this->once())
38+
->method('create')
39+
->with(StubAbstractSimpleObject::class, ['data' => []])
40+
->willReturn($stubSimpleObjectMock);
41+
$object = $this->stubSimpleObjectBuilderInterceptor->create();
42+
$this->assertInstanceOf(StubAbstractSimpleObject::class, $object);
43+
}
44+
}

0 commit comments

Comments
 (0)