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

api-platform / core / 6145149255

11 Sep 2023 10:27AM UTC coverage: 37.185% (+0.002%) from 37.183%
6145149255

push

github

web-flow
feat: deprecate not setting formats manually (#5808)

introduces documentation formats

Co-authored-by: Sarahshr <saraah.sahraoui@gmail.com>

47 of 47 new or added lines in 8 files covered. (100.0%)

10063 of 27062 relevant lines covered (37.18%)

19.79 hits per line

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

0.0
/src/Serializer/Tests/YamlEncoderTest.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Serializer\Tests;
15

16
use ApiPlatform\Serializer\YamlEncoder;
17
use PHPUnit\Framework\TestCase;
18

19
class YamlEncoderTest extends TestCase
20
{
21
    private YamlEncoder $encoder;
22

23
    protected function setUp(): void
24
    {
25
        $this->encoder = new YamlEncoder('yamlopenapi');
×
26
    }
27

28
    public function testSupportEncoding(): void
29
    {
30
        $this->assertTrue($this->encoder->supportsEncoding('yamlopenapi'));
×
31
        $this->assertFalse($this->encoder->supportsEncoding('json'));
×
32
    }
33

34
    public function testEncode(): void
35
    {
36
        $data = ['foo' => 'bar'];
×
37

38
        $this->assertSame('{ foo: bar }', $this->encoder->encode($data, 'yamlopenapi'));
×
39
    }
40

41
    public function testSupportDecoding(): void
42
    {
43
        $this->assertTrue($this->encoder->supportsDecoding('yamlopenapi'));
×
44
        $this->assertFalse($this->encoder->supportsDecoding('json'));
×
45
    }
46

47
    public function testDecode(): void
48
    {
49
        $this->assertEquals(['foo' => 'bar'], $this->encoder->decode('{ foo: bar }', 'yamlopenapi'));
×
50
    }
51

52
    public function testUTF8EncodedString(): void
53
    {
54
        $data = ['foo' => 'Über'];
×
55

56
        $this->assertEquals('{ foo: Über }', $this->encoder->encode($data, 'yamlopenapi'));
×
57
    }
58
}
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

© 2025 Coveralls, Inc