Passed
Push — main ( f3cfb1...17781b )
by Emil
04:34
created

ProductTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetAndGetMethods() 0 9 1
A testCreateObject() 0 4 1
1
<?php
2
3
namespace App\Tests\Entity;
4
5
use PHPUnit\Framework\TestCase;
6
use App\Entity\Product;
7
8
/**
9
 * Test cases for class Product.
10
 */
11
class ProductTest extends TestCase
12
{
13
    /**
14
     * testCreateObject
15
     *
16
     * Construct object and verify that the object has the expected
17
     * properties, use no arguments.
18
     *
19
     * @return void
20
     */
21
    public function testCreateObject(): void
22
    {
23
        $product = new Product();
24
        $this->assertInstanceOf(Product::class, $product);
25
    }
26
27
    /**
28
     * testSetAndGetMethods
29
     *
30
     * Test the set and get methods
31
     *
32
     * @return void
33
     */
34
    public function testSetAndGetMethods(): void
35
    {
36
        $product = new Product();
37
        $product->setName("Test");
38
        $product->setValue(69);
39
40
        $this->assertNull($product->getId());
41
        $this->assertEquals("Test", $product->getName());
42
        $this->assertEquals(69, $product->getValue());
43
    }
44
}
45