Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
LanguageTest
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 it_can_be_instantiated_with_a_valid_subtag
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 it_throws_an_exception_with_an_invalid_subtag
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 it_can_be_instantiated_with_an_active_subtag
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 it_throws_an_exception_with_an_invalid_active_subtag
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Apie\Tests\IanaValueObjects;
3
4use Apie\Core\ValueObjects\Exceptions\InvalidStringForValueObjectException;
5use Apie\IanaValueObjects\ActiveLanguage;
6use Apie\IanaValueObjects\Language;
7use PHPUnit\Framework\Attributes\Test;
8use PHPUnit\Framework\TestCase;
9
10class LanguageTest extends TestCase
11{
12    #[Test]
13    public function it_can_be_instantiated_with_a_valid_subtag()
14    {
15        $testItem = new Language('en');
16        $this->assertEquals('en', $testItem->toNative());
17    }
18
19    #[Test]
20    public function it_throws_an_exception_with_an_invalid_subtag()
21    {
22        $this->expectException(InvalidStringForValueObjectException::class);
23        new Language('invalid');
24    }
25
26    #[Test]
27    public function it_can_be_instantiated_with_an_active_subtag()
28    {
29        $testItem = new ActiveLanguage('en');
30        $this->assertEquals('en', $testItem->toNative());
31    }
32
33    #[Test]
34    public function it_throws_an_exception_with_an_invalid_active_subtag()
35    {
36        $this->expectException(InvalidStringForValueObjectException::class);
37        new ActiveLanguage('invalid');
38    }
39}