| @@ 19-40 (lines=22) @@ | ||
| 16 | $this->shouldHaveType(FieldPatchMessage::class); |
|
| 17 | } |
|
| 18 | ||
| 19 | function it_should_build() |
|
| 20 | { |
|
| 21 | $translation = new FieldTranslationMessage(); |
|
| 22 | $translation->setLocale('en'); |
|
| 23 | $translation->setValue('Secret'); |
|
| 24 | ||
| 25 | $this->setToken('some-field'); |
|
| 26 | $this->setDescription('Some description'); |
|
| 27 | $this->addTranslation($translation); |
|
| 28 | ||
| 29 | $transData = [ |
|
| 30 | 'value' => 'Secret', |
|
| 31 | ]; |
|
| 32 | ||
| 33 | $data = [ |
|
| 34 | 'token' => 'some-field', |
|
| 35 | 'description' => 'Some description', |
|
| 36 | 'translations' => ['en' => $transData], |
|
| 37 | ]; |
|
| 38 | ||
| 39 | $this->build()->shouldReturn($data); |
|
| 40 | } |
|
| 41 | ||
| 42 | function it_should_create_from_field(Field $field, FieldTranslation $translation) |
|
| 43 | { |
|
| @@ 17-38 (lines=22) @@ | ||
| 14 | $this->shouldHaveType(FieldPostMessage::class); |
|
| 15 | } |
|
| 16 | ||
| 17 | function it_should_build() |
|
| 18 | { |
|
| 19 | $translation = new FieldTranslationMessage(); |
|
| 20 | $translation->setLocale('en'); |
|
| 21 | $translation->setValue('Secret'); |
|
| 22 | ||
| 23 | $this->setToken('some-field'); |
|
| 24 | $this->setDescription('Some description'); |
|
| 25 | $this->addTranslation($translation); |
|
| 26 | ||
| 27 | $transData = [ |
|
| 28 | 'value' => 'Secret', |
|
| 29 | ]; |
|
| 30 | ||
| 31 | $data = [ |
|
| 32 | 'token' => 'some-field', |
|
| 33 | 'description' => 'Some description', |
|
| 34 | 'translations' => ['en' => $transData], |
|
| 35 | ]; |
|
| 36 | ||
| 37 | $this->build()->shouldReturn($data); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||