<?php

namespace Unit\Repository;

use App\Entity\Nameserver;
use Unit\Controller\BindApiControllerTest;

/**
 *
 */
class NameserverRepositoryTest extends BindApiControllerTest
{
	/**
	 */
	public function testInsert()
	{
		$nameserver = new Nameserver(name: 'inserttest.org', a: '1.2.3.4', aaaa: '1bad::babe');
		$this->nameserverRepository->insert(nameserver: $nameserver);
		
		$nameserverTest = $this->nameserverRepository->findByName(name: 'inserttest.org');
		$this->assertIsNotBool(actual: $nameserver);
		$this->assertEquals(expected: 'inserttest.org', actual: $nameserverTest->getName());
		// clean up
		$this->nameserverRepository->delete(id: $nameserverTest->getId());
	}
	
}