Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
StaticImageRecommendationMetadataProvider
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 getMetadata
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getFileMetadata
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getStaticData
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace GrowthExperiments\NewcomerTasks\AddImage;
4
5/**
6 * Static metadata provider, used only for testing.
7 */
8class StaticImageRecommendationMetadataProvider extends ImageRecommendationMetadataProvider {
9
10    /** @inheritDoc */
11    public function getMetadata( array $suggestion ) {
12        return $this->getStaticData();
13    }
14
15    /** @inheritDoc */
16    public function getFileMetadata( string $filename ) {
17        return $this->getStaticData();
18    }
19
20    /**
21     * TODO: Parametrize this function.
22     *
23     * @return array
24     */
25    private function getStaticData(): array {
26        return [
27            'descriptionUrl' => 'https://commons.wikimedia.org/wiki/File:Mamoul_biscotti_libanesi.jpg',
28            'thumbUrl' =>
29                'https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Mamoul_biscotti_l' .
30                'ibanesi.jpg/120px-Mamoul_biscotti_libanesi.jpg',
31            'fullUrl' => 'https://upload.wikimedia.org/wikipedia/commons/9/9e/Mamoul_biscotti_libanesi.jpg',
32            'originalWidth' => 300,
33            'originalHeight' => 300,
34            'mustRender' => true,
35            'isVectorized' => false,
36            'mediaType' => 'BITMAP'
37        ];
38    }
39
40}