|
@@ 84-94 (lines=11) @@
|
| 81 |
|
* @uses \Tfboe\FmLib\Entity\Helpers\BaseEntity::methodExists |
| 82 |
|
* @uses \Tfboe\FmLib\Http\Controllers\BaseController::__construct |
| 83 |
|
*/ |
| 84 |
|
public function testSetFromSpecificationWithDefault() |
| 85 |
|
{ |
| 86 |
|
$value = "test-value"; |
| 87 |
|
$specification['prop'] = ['default' => $value]; |
| 88 |
|
$object = self::getMockForAbstractClass(BaseEntity::class, [], '', true, true, true, ['setProp']); |
| 89 |
|
$object->expects(static::once())->method('setProp')->with($value)->willReturnSelf(); |
| 90 |
|
$controller = $this->controller(); |
| 91 |
|
/** @noinspection PhpUnhandledExceptionInspection */ |
| 92 |
|
$method = self::getMethod(UserController::class, 'setFromSpecification'); |
| 93 |
|
$method->invokeArgs($controller, [$object, $specification, []]); |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
/** |
| 97 |
|
* @covers \Tfboe\FmLib\Http\Controllers\BaseController::setFromSpecification |
|
@@ 101-111 (lines=11) @@
|
| 98 |
|
* @uses \Tfboe\FmLib\Http\Controllers\BaseController::__construct |
| 99 |
|
* @uses \Tfboe\FmLib\Http\Controllers\BaseController::transformValue |
| 100 |
|
*/ |
| 101 |
|
public function testSetFromSpecificationWithProperty() |
| 102 |
|
{ |
| 103 |
|
$value = 'test-value'; |
| 104 |
|
$specification['attr'] = ['property' => 'prop']; |
| 105 |
|
$object = self::getMockForAbstractClass(BaseEntity::class, [], '', true, true, true, ['setProp']); |
| 106 |
|
$object->expects(static::once())->method('setProp')->with($value)->willReturnSelf(); |
| 107 |
|
$controller = $this->controller(); |
| 108 |
|
/** @noinspection PhpUnhandledExceptionInspection */ |
| 109 |
|
$method = self::getMethod(UserController::class, 'setFromSpecification'); |
| 110 |
|
$method->invokeArgs($controller, [$object, $specification, ['attr' => $value]]); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* @covers \Tfboe\FmLib\Http\Controllers\BaseController::transformValue |