<?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'),
);
}
}
|