Commit 071efbb8 authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT

Ajout du provider et des dates de mise à jour et de création dans la réponse json

parent 5105dc18
Pipeline #10677 passed with stage
in 46 seconds
...@@ -32,7 +32,11 @@ class Media extends ModelAbstract { ...@@ -32,7 +32,11 @@ class Media extends ModelAbstract {
public function getJsonAttributes() { public function getJsonAttributes() {
return array_intersect_key($this->getRawAttributes(), return array_intersect_key($this->getRawAttributes(),
['type' => 1, 'url' => 1]); ['type' => 1,
'url' => 1,
'provider' => 1,
'created_at' => 1,
'updated_at' => 1]);
} }
......
...@@ -63,9 +63,15 @@ class MediaLocalRecordTest extends TestCase { ...@@ -63,9 +63,15 @@ class MediaLocalRecordTest extends TestCase {
$expected = [ 'media'=> $expected = [ 'media'=>
[ [
[ 'url' => 'http://image.org/city.jpg', [ 'url' => 'http://image.org/city.jpg',
'provider' => 'Me',
'created_at' => '2020-01-13 08:00:00',
'updated_at' => '2020-01-16 08:00:00',
'type' => 'cover'], 'type' => 'cover'],
[ 'url' => 'http://image.org/cityback.jpg', [ 'url' => 'http://image.org/cityback.jpg',
'type' => 'back_cover' 'type' => 'back_cover',
'provider' => 'Me',
'created_at' => '2020-01-21 08:00:00',
'updated_at' => '2020-02-14 08:00:00'
] ]
] ]
]; ];
...@@ -136,8 +142,10 @@ abstract class MediaWithElectreTestCase extends TestCase { ...@@ -136,8 +142,10 @@ abstract class MediaWithElectreTestCase extends TestCase {
$return_data = $return_data =
[ 'media' => [ [ 'media' => [
['url'=> 'http://image.org/city.jpg', ['url'=> 'http://image.org/city.jpg',
'provider' => 'Electre',
'type' => 'cover'], 'type' => 'cover'],
['url' => 'http://image.org/cityback.jpg', ['url' => 'http://image.org/cityback.jpg',
'provider' => 'Electre',
'type' => 'back_cover'] 'type' => 'back_cover']
] ]
]; ];
...@@ -399,6 +407,7 @@ abstract class MediaWithOrbTestCase extends TestCase { ...@@ -399,6 +407,7 @@ abstract class MediaWithOrbTestCase extends TestCase {
$return_data = $return_data =
[ 'media' => [ [ 'media' => [
['url'=> 'https://products-images.di-static.com/image/orb-9162f416a0b7b2e64a1f5480db8d4394/2259228234-475x500-1.jpg', ['url'=> 'https://products-images.di-static.com/image/orb-9162f416a0b7b2e64a1f5480db8d4394/2259228234-475x500-1.jpg',
'provider' => 'Orb',
'type' => 'cover'] 'type' => 'cover']
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment