Skip to content

Commit bf87df0

Browse files
committed
Cover identity validator with integration tests
1 parent 6bf9b7a commit bf87df0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\DataObject;
7+
8+
class IdentityValidatorTest extends \PHPUnit\Framework\TestCase
9+
{
10+
const VALID_UUID = 'fe563e12-cf9d-4faf-82cd-96e011b557b7';
11+
const INVALID_UUID = 'abcdef';
12+
13+
/**
14+
* @var IdentityValidator
15+
*/
16+
protected $identityValidator;
17+
18+
protected function setUp()
19+
{
20+
$this->identityValidator = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
21+
->get(IdentityValidator::class);
22+
}
23+
24+
public function testIsValid()
25+
{
26+
$isValid = $this->identityValidator->isValid(self::VALID_UUID);
27+
$this->assertEquals(true, $isValid);
28+
}
29+
30+
public function testIsNotValid()
31+
{
32+
$isValid = $this->identityValidator->isValid(self::INVALID_UUID);
33+
$this->assertEquals(false, $isValid);
34+
}
35+
36+
public function testEmptyValue()
37+
{
38+
$isValid = $this->identityValidator->isValid('');
39+
$this->assertEquals(false, $isValid);
40+
}
41+
}

0 commit comments

Comments
 (0)