post-fixtures/test/PostFixturesTest.php

33 lines
769 B
PHP
Raw Normal View History

2009-11-22 20:35:39 +00:00
<?php
2009-11-22 20:50:16 +00:00
require_once('PHPUnit/Framework.php');
require_once('MockPress/mockpress.php');
require_once(dirname(__FILE__) . '/../classes/PostFixtures.inc');
class PostFixturesTest extends PHPUnit_Framework_TestCase {
function setUp() {
_reset_wp();
$this->pf = new PostFixtures();
}
function providerTestParseJSON() {
return array(
array(false, false),
array('', false),
array('{]', false),
array('{}', array()),
2009-11-22 20:56:00 +00:00
array('[]', array()),
array('["test", "test2"]', array('test', 'test2')),
array('{"one": "test", "two": "test2"}', array('test', 'test2'))
2009-11-22 20:50:16 +00:00
);
}
/**
* @dataProvider providerTestParseJSON
*/
function testParseJSON($input, $expected_output) {
$this->assertEquals($expected_output, $this->pf->parse_json($input));
}
}