PHP Classes

File: tests/Fakerino/Test/Core/FakeHandler/RegExFakerClassTest.php

Recommend this page to a friend!
  Classes of Nicola Pietroluongo   Fakerino   tests/Fakerino/Test/Core/FakeHandler/RegExFakerClassTest.php   Download  
File: tests/Fakerino/Test/Core/FakeHandler/RegExFakerClassTest.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 code style, add more test for the fake table feature
Date: 7 years ago
Size: 1,281 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\Test\Core\FakeHandler;

use
Fakerino\Core\FakeElement;
use
Fakerino\Core\FakeHandler\RegExFakerClass;
use
Fakerino\Core\RegEx\RegRevGenerator;

/**
 * @group handler
 */
class RegExFakerClassTest extends \PHPUnit_Framework_TestCase
{
    public function
testHandler()
    {
       
$length = 3;
       
$handler = new RegExFakerClass(new RegRevGenerator());
       
$customClass = new FakeElement('/\d{' . $length . '}/');
       
$result = $handler->handle($customClass);

       
$this->assertInstanceOf('Fakerino\Core\FakeHandler\Handler', $handler);
       
$this->assertEquals($length, strlen($result));
    }

    public function
testHandlerOptions()
    {
       
$length = 3;
       
$handler = new RegExFakerClass(new RegRevGenerator());
       
$customClass = new FakeElement('number', '/\d{' . $length . '}/');
       
$result = $handler->handle($customClass);

       
$this->assertInstanceOf('Fakerino\Core\FakeHandler\Handler', $handler);
       
$this->assertEquals($length, strlen($result));
    }
}