<commit_before><?php
/**
 * Unit test for InstitutionUserService
 * 
 * @author <NAME>
 */
namespace HealthCareAbroad\MedicalProcedureBundle\Tests\Services;

use HealthCareAbroad\MedicalProcedureBundle\Entity\MedicalProcedureType;

use HealthCareAbroad\MedicalProcedureBundle\Entity\MedicalProcedure;

use HealthCareAbroad\MedicalProcedureBundle\Tests\MedicalProcedureBundleTestCase;

use HealthCareAbroad\MedicalProcedureBundle\Services\MedicalProcedureService;

class MedicalProcedureServiceTest extends MedicalProcedureBundleTestCase
{
    protected $service;
    
    public function setUp()
	{
		$this->service = new MedicalProcedureService();
		$this->service->setContainer($this->getServiceContainer());
	}

	public function tearDown()
	{
		$this->service = null;
	}

	public function testCreateMedicalProcedureType()
	{
		try {
			
			for($i = 0; $i< 3; $i++) {
			
				$procedureType = new MedicalProcedureType();
				$procedureType->setDateCreated(new \DateTime())
				->setDateModified($procedureType->getDateCreated())
				->setName('ProcedureTypeTestUnit ' . $i)
				->setDescription('this is a test description')
				->setSlug('ProcedureTypeTestUnit')
				->setStatus(1);

				$procedureType = $this->service->saveMedicalProcedureType($procedureType);
			}
		} catch (\Exception $e) {
			$this->getDoctrine()->resetEntityManager();
			throw $e;
		}

		$this->assertNotEmpty($procedureType);
	}
	
	public function testSaveMedicalProcedure()
	{
		
		$procedureType = $this->getDoctrine()->getEntityManager()->getRepository('MedicalProcedureBundle:MedicalProcedureType')->find(1);

		$procedure = new MedicalProcedure();
		$procedure->setMedicalProcedureType($procedureType);
		$procedure->setName('medProdTest FromUnitTest');
		$procedure->setSlug('medprodtest-fromunittest');
		$procedure->setStatus(1);
        
        try {
            $procedure = $this->service->saveMedicalProcedure($procedure);
        }
        catch (\Exception $e)
        {
            $this->getDoctrine()->resetEntityManager();
            throw $e;
        }
	    
	    
	    $this->assertNotEmpty($procedure);
	    
	    return $procedure;
	}
	
	public function testGetMedicalProcedure()
	{
		$procedure = $this->service->getMedicalProcedure(1);
		$this->assertNotEmpty($procedure);
	}

	public function testGetMedicalProcedureType()
	{
		$procedureType = $this->service->getMedicalProcedureType(1);
		$this->assertNotEmpty($procedureType);
	}

	public function testGetMedicalProcedureTypes()
	{
		$procedureTypes = $this->service->getMedicalProcedureTypes();
		var_dump(count($procedureTypes));
		$this->assertNotEmpty($procedureTypes);
	}
}<commit_msg>removed test for non existent HealthCareAbroad\MedicalProcedureBundle\Services\MedicalProcedureService::getMedicalProcedureTypes() method<commit_after><?php
/**
 * Unit test for InstitutionUserService
 * 
 * @author <NAME>
 */
namespace HealthCareAbroad\MedicalProcedureBundle\Tests\Services;

use HealthCareAbroad\MedicalProcedureBundle\Entity\MedicalProcedureType;

use HealthCareAbroad\MedicalProcedureBundle\Entity\MedicalProcedure;

use HealthCareAbroad\MedicalProcedureBundle\Tests\MedicalProcedureBundleTestCase;

use HealthCareAbroad\MedicalProcedureBundle\Services\MedicalProcedureService;

class MedicalProcedureServiceTest extends MedicalProcedureBundleTestCase
{
    protected $service;
    
    public function setUp()
	{
		$this->service = new MedicalProcedureService();
		$this->service->setContainer($this->getServiceContainer());
	}

	public function tearDown()
	{
		$this->service = null;
	}

	public function testCreateMedicalProcedureType()
	{
		try {
			
			for($i = 0; $i< 3; $i++) {
			
				$procedureType = new MedicalProcedureType();
				$procedureType->setDateCreated(new \DateTime())
				->setDateModified($procedureType->getDateCreated())
				->setName('ProcedureTypeTestUnit ' . $i)
				->setDescription('this is a test description')
				->setSlug('ProcedureTypeTestUnit')
				->setStatus(1);

				$procedureType = $this->service->saveMedicalProcedureType($procedureType);
			}
		} catch (\Exception $e) {
			$this->getDoctrine()->resetEntityManager();
			throw $e;
		}

		$this->assertNotEmpty($procedureType);
	}
	
	public function testSaveMedicalProcedure()
	{
		
		$procedureType = $this->getDoctrine()->getEntityManager()->getRepository('MedicalProcedureBundle:MedicalProcedureType')->find(1);

		$procedure = new MedicalProcedure();
		$procedure->setMedicalProcedureType($procedureType);
		$procedure->setName('medProdTest FromUnitTest');
		$procedure->setSlug('medprodtest-fromunittest');
		$procedure->setStatus(1);
        
        try {
            $procedure = $this->service->saveMedicalProcedure($procedure);
        }
        catch (\Exception $e)
        {
            $this->getDoctrine()->resetEntityManager();
            throw $e;
        }
	    
	    
	    $this->assertNotEmpty($procedure);
	    
	    return $procedure;
	}
	
	public function testGetMedicalProcedure()
	{
		$procedure = $this->service->getMedicalProcedure(1);
		$this->assertNotEmpty($procedure);
	}

	public function testGetMedicalProcedureType()
	{
		$procedureType = $this->service->getMedicalProcedureType(1);
		$this->assertNotEmpty($procedureType);
	}
}
{'fraction_non_alphanumeric': 0.12861244019138757, 'fraction_numerical': 0.002679425837320574, 'mean_word_length': 4.541887592788972, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1798121', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1494, 'n_words': 223}