![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Data/Test/Unit/Argument/Interpreter/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\Data\Test\Unit\Argument\Interpreter; use Magento\Framework\Data\Argument\Interpreter\Boolean; use Magento\Framework\Stdlib\BooleanUtils; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class BooleanTest extends TestCase { /** * @var Boolean */ protected $_model; /** * @var MockObject */ protected $_booleanUtils; protected function setUp(): void { $this->_booleanUtils = $this->createMock(BooleanUtils::class); $this->_model = new Boolean($this->_booleanUtils); } public function testEvaluateException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Boolean value is missing'); $this->_model->evaluate([]); } public function testEvaluate() { $input = new \stdClass(); $expected = new \stdClass(); $this->_booleanUtils->expects( $this->once() )->method( 'toBoolean' )->with( $this->identicalTo($input) )->willReturn( $expected ); $actual = $this->_model->evaluate(['value' => $input]); $this->assertSame($expected, $actual); } }