<?php

namespace App\Tests\Entity;

use App\Entity\EtatLieux;
use App\Entity\Prestaire;
use PHPUnit\Framework\TestCase;

class PrestaireTest extends TestCase
{
    public function testGettersAndSetters()
    {
        $prestaire = new Prestaire();
        $prestaire->setEmail('prestaire@test.com');
        $prestaire->setName('PrestaireName');
        $prestaire->setSurname('PrestaireSurname');
        $prestaire->setPhone('0123456789');
        $prestaire->setRoles(['ROLE_PRESTAIRE']);

        $this->assertEquals('prestaire@test.com', $prestaire->getEmail());
        $this->assertEquals('PrestaireName', $prestaire->getName());
        $this->assertEquals('PrestaireSurname', $prestaire->getSurname());
        $this->assertEquals('0123456789', $prestaire->getPhone());
        $this->assertContains('ROLE_PRESTAIRE', $prestaire->getRoles());
        // $this->assertNull($prestaire->getPassword()); // As per entity's getPassword() TODO
        $this->assertEquals('prestaire@test.com', $prestaire->getUserIdentifier());
    }

    public function testEtatLieuxesCollection()
    {
        $prestaire = new Prestaire();
        $etatLieux = new EtatLieux();

        $this->assertCount(0, $prestaire->getEtatLieuxes());
        $prestaire->addEtatLieux($etatLieux);
        $this->assertCount(1, $prestaire->getEtatLieuxes());
        $this->assertSame($prestaire, $etatLieux->getPrestataire());

        $prestaire->removeEtatLieux($etatLieux);
        $this->assertCount(0, $prestaire->getEtatLieuxes());
        $this->assertNull($etatLieux->getPrestataire());
    }

    public function testEraseCredentials()
    {
        $prestaire = new Prestaire();
        $prestaire->eraseCredentials(); // Should do nothing as per entity's eraseCredentials() TODO
        $this->assertTrue(true); // Just ensure it doesn't crash
    }
}
