ProductTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetValueAndGetValue() 0 6 1
A testSetNameAndGetName() 0 6 1
A testInitialIdIsNull() 0 5 1
1
<?php
2
3
namespace App\Tests\Entity;
4
5
use App\Entity\Product;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * Test cases for the Product entity.
10
 */
11
class ProductTest extends TestCase
12
{
13
    /**
14
     * Test set and get name.
15
     */
16
    public function testSetNameAndGetName(): void
17
    {
18
        $product = new Product();
19
        $product->setName("Test Product");
20
21
        $this->assertEquals("Test Product", $product->getName());
22
    }
23
24
    /**
25
     * Test set and get value.
26
     */
27
    public function testSetValueAndGetValue(): void
28
    {
29
        $product = new Product();
30
        $product->setValue(38);
31
32
        $this->assertEquals(38, $product->getValue());
33
    }
34
35
    /**
36
     * Test initial id is null.
37
     */
38
    public function testInitialIdIsNull(): void
39
    {
40
        $product = new Product();
41
42
        $this->assertNull($product->getId());
43
    }
44
}
45