|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * This file is part of littleredbutton/bigbluebutton-api-php. |
| 7 | + * |
| 8 | + * littleredbutton/bigbluebutton-api-php is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU Lesser General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * littleredbutton/bigbluebutton-api-php is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU Lesser General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public License |
| 19 | + * along with littleredbutton/bigbluebutton-api-php. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + */ |
| 21 | +namespace BigBlueButton\Parameters; |
| 22 | + |
| 23 | +use PHPUnit\Framework\TestCase; |
| 24 | + |
| 25 | +final class BaseParametersTest extends TestCase |
| 26 | +{ |
| 27 | + public function testBooleanGetterWithNonBoolean(): void |
| 28 | + { |
| 29 | + $params = new TestParameters(); |
| 30 | + |
| 31 | + $this->expectException(\BadFunctionCallException::class); |
| 32 | + $this->expectExceptionMessage('notABool is not a boolean property'); |
| 33 | + |
| 34 | + $params->isNotABool(); |
| 35 | + } |
| 36 | + |
| 37 | + public function testGetterWithInvalid(): void |
| 38 | + { |
| 39 | + $params = new TestParameters(); |
| 40 | + |
| 41 | + $this->expectException(\BadFunctionCallException::class); |
| 42 | + $this->expectExceptionMessage('invalid is not a valid property'); |
| 43 | + |
| 44 | + $params->getInvalid(); |
| 45 | + } |
| 46 | + |
| 47 | + public function testSetterWithInvalid(): void |
| 48 | + { |
| 49 | + $params = new TestParameters(); |
| 50 | + |
| 51 | + $this->expectException(\BadFunctionCallException::class); |
| 52 | + $this->expectExceptionMessage('invalid is not a valid property'); |
| 53 | + |
| 54 | + $params->setInvalid('foobar'); |
| 55 | + } |
| 56 | +} |
| 57 | + |
| 58 | +/** |
| 59 | + * @internal |
| 60 | + * |
| 61 | + * @method isNotABool() |
| 62 | + * @method getInvalid() |
| 63 | + * @method setInvalid(string $invalid) |
| 64 | + */ |
| 65 | +final class TestParameters extends BaseParameters |
| 66 | +{ |
| 67 | + protected $notABool = 'string'; |
| 68 | +} |
0 commit comments