PHP Classes

File: tests/Fakerino/Test/Core/RegEx/RegRevGeneratorTest.php

Recommend this page to a friend!
  Classes of Nicola Pietroluongo   Fakerino   tests/Fakerino/Test/Core/RegEx/RegRevGeneratorTest.php   Download  
File: tests/Fakerino/Test/Core/RegEx/RegRevGeneratorTest.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: 882 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\RegEx;

use
Fakerino\Core\RegEx\RegRevGenerator;

class
RegRevGeneratorTest extends \PHPUnit_Framework_TestCase
{

    public function
testGenerate()
    {
       
$generator = new RegRevGenerator();
       
$length = 3;
       
$expr = '/\d{' . $length . '}/';

       
$this->assertEquals($length, strlen($generator->generate($expr)));
    }

    public function
testNotValidRegularExpression()
    {
       
$this->setExpectedException('Fakerino\Core\RegEx\Exception\InvalidRegexException');

       
$generator = new RegRevGenerator();
       
$expr = '\\';
       
$generator->generate($expr);
    }
}