Login   Register  
PHP Classes
elePHPant
Icontem

File: Tests/JSONFunctionTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Aldo Stracquadanio  >  JSON Builder  >  Tests/JSONFunctionTest.php  >  Download  
File: Tests/JSONFunctionTest.php
Role: Unit test script
Content type: text/plain
Description: Unit tests for the JSONFunction class
Class: JSON Builder
Encode associative array as object in JSON format
Author: By
Last change:
Date: 3 years ago
Size: 1,011 bytes
 

Contents

Class file image Download
<?php

namespace A2PLab\Component\JSONBuilder\Tests;

use 
A2PLab\Component\JSONBuilder\JSONBuilder;
use 
A2PLab\Component\JSONBuilder\JSONFunction;
use 
PHPUnit_Framework_TestCase;

class 
JSONFunctionTest extends PHPUnit_Framework_TestCase {
    
    protected 
$fn;
    
    
/**
     * @dataProvider getFunctionTests
     */
    
public function testCreate($functionBody) {
        
$fm = new JSONFunction($functionBody);
        
$this->assertEquals($functionBody$fm->getBody(), 'JSONFunction body error after creation');
    }
    
    
/**
     * @dataProvider getFunctionTests
     */
    
public function testBodySet($functionBody) {
        
$fn = new JSONFunction('');
        
$fn->setBody($functionBody);
        
$this->assertEquals($functionBody$fn->getBody(), 'JSONFunction body set/get is not working');
    }
    
    public function 
getFunctionTests() {
        return array(
            array(
'function() {  }'),
            array(
'myFunction'),
        );
    }
}