• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sulu / SuluContentBundle / 12008183499

25 Nov 2024 10:35AM UTC coverage: 97.468% (-2.5%) from 100.0%
12008183499

push

github

web-flow
Add Base implementation of website content resolving (#271)

* Add own implementation of Controller

* Add PropertyResolver and MediaResourceLoader

* Add review suggestions

* Add unit tests

* Add sulu/sulu fork

* Keep required sulu version

* Update Content/Application/ContentResolver/Value/ContentView.php

Co-authored-by: Alexander Schranz <alexander@sulu.io>

* Update Content/Application/ResourceLoader/ResourceLoaderInterface.php

Co-authored-by: Alexander Schranz <alexander@sulu.io>

* Remove sulu fork

* Fix tests for php 8.1

* Fix tests for php 8.0

* Enhance content resolver test

* Refactor contentResolver and add LinkPropertyProvider

* Add tests

* Add TeaserSelectionPropertyResolver

* Move interfaces and adjust namespaces

* Define COMPOSER_TOKEN to fix issues with using forks

* Use automation bundle 3.0

* Update Sulu required version

* Define composer requirements for Sulu 3.0

* Fix failings tests

* Add debug line

* Skip resolver tests for now

* Trigger CI

* Ignore skipped tests

---------

Co-authored-by: Alexander Schranz <alexander@sulu.io>

280 of 353 new or added lines in 17 files covered. (79.32%)

2810 of 2883 relevant lines covered (97.47%)

10.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.23
/Content/Application/ContentResolver/Value/ContentView.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of Sulu.
7
 *
8
 * (c) Sulu GmbH
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13

14
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\Value;
15

16
/**
17
 * @internal This class is intended for internal use only within the package/library. Modifying or depending on this class may result in unexpected behavior and is not supported.
18
 */
19
class ContentView
20
{
21
    /**
22
     * @param mixed[] $view
23
     */
24
    private function __construct(
25
        private mixed $content,
26
        private array $view
27
    ) {
28
    }
36✔
29

30
    /**
31
     * @param mixed[] $view
32
     */
33
    public static function create(mixed $content, array $view): self
34
    {
35
        return new self($content, $view);
31✔
36
    }
37

38
    /**
39
     * @param mixed[] $view
40
     */
41
    public static function createResolvable(string|int $id, string $resourceLoaderKey, array $view, ?\Closure $closure = null): self
42
    {
43
        return new self(new ResolvableResource($id, $resourceLoaderKey, $closure), $view);
7✔
44
    }
45

46
    /**
47
     * @param array<string|int> $ids
48
     * @param mixed[] $view
49
     */
50
    public static function createResolvables(array $ids, string $resourceLoaderKey, array $view): self
51
    {
52
        $resolvableResources = [];
2✔
53

54
        foreach ($ids as $id) {
2✔
55
            $resolvableResources[] = new ResolvableResource($id, $resourceLoaderKey);
2✔
56
        }
57

58
        return new self($resolvableResources, $view);
2✔
59
    }
60

61
    public function getContent(): mixed
62
    {
63
        return $this->content;
35✔
64
    }
65

66
    /**
67
     * @return mixed[]
68
     */
69
    public function getView(): array
70
    {
71
        return $this->view;
30✔
72
    }
73

74
    public function setContent(mixed $content): self
75
    {
NEW
76
        $this->content = $content;
×
77

NEW
78
        return $this;
×
79
    }
80

81
    /**
82
     * @param mixed[] $view
83
     */
84
    public function setView(array $view): self
85
    {
NEW
86
        $this->view = $view;
×
87

NEW
88
        return $this;
×
89
    }
90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc