ValidatorTest.php 957 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Code\Test\Unit;
  7. use \Magento\Framework\Code\Validator;
  8. class ValidatorTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var Validator
  12. */
  13. protected $model;
  14. protected function setUp()
  15. {
  16. $this->model = new Validator();
  17. }
  18. public function testValidate()
  19. {
  20. $className = 'Same\Class\Name';
  21. $validator1 = $this->createMock(\Magento\Framework\Code\ValidatorInterface::class);
  22. $validator1->expects($this->once())->method('validate')->with($className);
  23. $validator2 = $this->createMock(\Magento\Framework\Code\ValidatorInterface::class);
  24. $validator2->expects($this->once())->method('validate')->with($className);
  25. $this->model->add($validator1);
  26. $this->model->add($validator2);
  27. $this->model->validate($className);
  28. }
  29. }