PHP Classes

File: tests/Fakerino/Test/Core/Filler/EntityFillerTest.php

Recommend this page to a friend!
  Classes of Nicola Pietroluongo  >  Fakerino  >  tests/Fakerino/Test/Core/Filler/EntityFillerTest.php  >  Download  
File: tests/Fakerino/Test/Core/Filler/EntityFillerTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Fakerino
Generate fake names and other types of fake data
Author: By
Last change: * Fix nested fake bug
* Fix yml parser bug
* Add tests
* Refactor classes
Date: 6 years ago
Size: 2,052 bytes
 

Contents

Class file image Download
<?php
/**
 * This file is part of the Fakerino package.
 *
 * (c) Nicola Pietroluongo <nik.longstone@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Fakerino\Core\Test\Filler;

use
Fakerino\Core\Database\DoctrineLayer;
use
Fakerino\Core\FakeDataFactory;
use
Fakerino\Core\FakeHandler;
use
Fakerino\Core\Filler\EntityFiller;
use
Fakerino\Core\Template\TwigTemplate;
use
Fakerino\Test\Fixtures\TestEntity;

class
EntityFillerTest extends \PHPUnit_Framework_TestCase
{
    public function
setUp()
    {
       
$fakeHandler = new FakeHandler\FakeHandler();
       
$fakeHandler->setSuccessor(new FakeHandler\CustomFakerClass());
       
$fakeHandler->setSuccessor(new FakeHandler\DefaultFakerClass());

       
$this->faker = new FakeDataFactory($fakeHandler, new DoctrineLayer(null), new TwigTemplate());
    }

    public function
testFillProperties()
    {
       
$this->setUpFiller();
       
$this->entityFiller->fillProperties();

       
$this->assertNotNull($this->testEntity->getOne());
       
$this->assertNotNull($this->testEntity->getFour());
       
$this->assertNull($this->testEntity->getTwo());
    }

    public function
testFillMethods()
    {
       
$this->setUpFiller();
       
$this->entityFiller->fillMethods();

       
$this->assertNotNull($this->testEntity->getTwo());
       
$this->assertNotNull($this->testEntity->getThree());
       
$this->assertNull($this->testEntity->getOne());
    }

    public function
testFill()
    {
       
$this->setUpFiller();
       
$this->entityFiller->fill();

       
$this->assertNotNull($this->testEntity->getOne());
       
$this->assertNotNull($this->testEntity->getFour());
       
$this->assertNotNull($this->testEntity->getOne());
       
$this->assertNotNull($this->testEntity->getFour());
    }

    private function
setUpFiller()
    {
       
$this->testEntity = new TestEntity();
       
$this->entityFiller = new EntityFiller($this->testEntity, $this->faker);
    }
}

For more information send a message to info at phpclasses dot org.