Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
45.45% |
5 / 11 |
|
45.45% |
5 / 11 |
CRAP | |
0.00% |
0 / 1 |
| Measurement | |
45.45% |
5 / 11 |
|
45.45% |
5 / 11 |
30.64 | |
0.00% |
0 / 1 |
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getYear | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setYear | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMonth | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setMonth | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getVersion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setVersion | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testOnlyGetField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Entity; |
| 4 | |
| 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | use Olz\Entity\Common\TestableInterface; |
| 7 | use Olz\Repository\MeasurementRepository; |
| 8 | |
| 9 | #[ORM\Table(name: 'measurements')] |
| 10 | #[ORM\Entity(repositoryClass: MeasurementRepository::class)] |
| 11 | class Measurement implements TestableInterface { |
| 12 | #[ORM\Id] |
| 13 | #[ORM\Column(type: 'string', length: 31, nullable: false)] |
| 14 | private string $name; |
| 15 | |
| 16 | #[ORM\Id] |
| 17 | #[ORM\Column(type: 'integer', nullable: true)] |
| 18 | private ?int $year; |
| 19 | |
| 20 | #[ORM\Id] |
| 21 | #[ORM\Column(type: 'integer', nullable: true)] |
| 22 | private ?int $month; |
| 23 | |
| 24 | #[ORM\Column(type: 'float', nullable: true)] |
| 25 | private ?float $value; |
| 26 | |
| 27 | #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])] |
| 28 | private int $version; |
| 29 | |
| 30 | public function getName(): string { |
| 31 | return $this->name; |
| 32 | } |
| 33 | |
| 34 | public function setName(string $new_value): void { |
| 35 | $this->name = $new_value; |
| 36 | } |
| 37 | |
| 38 | public function getYear(): ?int { |
| 39 | return $this->year; |
| 40 | } |
| 41 | |
| 42 | public function setYear(?int $new_value): void { |
| 43 | $this->year = $new_value; |
| 44 | } |
| 45 | |
| 46 | public function getMonth(): ?int { |
| 47 | return $this->month; |
| 48 | } |
| 49 | |
| 50 | public function setMonth(?int $new_value): void { |
| 51 | $this->month = $new_value; |
| 52 | } |
| 53 | |
| 54 | public function getValue(): ?float { |
| 55 | return $this->value; |
| 56 | } |
| 57 | |
| 58 | public function setValue(?float $new_value): void { |
| 59 | $this->value = $new_value; |
| 60 | } |
| 61 | |
| 62 | public function getVersion(): int { |
| 63 | return $this->version; |
| 64 | } |
| 65 | |
| 66 | public function setVersion(int $new_value): void { |
| 67 | $this->version = $new_value; |
| 68 | } |
| 69 | // --- |
| 70 | |
| 71 | public function testOnlyGetField(string $field_name): mixed { |
| 72 | return $this->{$field_name}; |
| 73 | } |
| 74 | } |