| 1 | <?php |
||
| 10 | class FieldTranslationMessageSpec extends ObjectBehavior |
||
| 11 | { |
||
| 12 | function it_is_initializable() |
||
| 13 | { |
||
| 14 | $this->shouldHaveType(FieldTranslationMessage::class); |
||
| 15 | } |
||
| 16 | |||
| 17 | function it_should_build() |
||
| 18 | { |
||
| 19 | $this->setLocale('en'); |
||
| 20 | $this->setValue('Some data'); |
||
| 21 | |||
| 22 | $data = [ |
||
| 23 | 'value' => 'Some data', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | $this->build()->shouldReturn($data); |
||
| 27 | } |
||
| 28 | |||
| 29 | function it_should_create_from_field_translation(FieldTranslation $translation) |
||
| 30 | { |
||
| 31 | $translation->getLocale()->willReturn('en'); |
||
| 32 | $translation->getValue()->willReturn('Some data'); |
||
| 33 | |||
| 34 | $message = new FieldTranslationMessage(); |
||
| 35 | $message->setLocale('en'); |
||
| 36 | $message->setValue('Some data'); |
||
| 37 | |||
| 38 | $this::createFromFieldTranslation($translation)->shouldBeLike($message); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |