forked from propelorm/Propel2
/
MappingModelTest.php
58 lines (50 loc) · 1.38 KB
/
MappingModelTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Propel\Tests\Generator\Model;
use Propel\Generator\Model\MappingModel;
/**
* @author William Durand <william.durand1@gmail.com>
*/
class MappingModelTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider providerForGetDefaultValueForArray
*/
public function testGetDefaultValueForArray($value, $expected)
{
$mappingModel = new TestableMappingModel();
$this->assertEquals($expected, $mappingModel->getDefaultValueForArray($value));
}
public static function providerForGetDefaultValueForArray()
{
return array(
array('', null),
array(null, null),
array('FOO', '||FOO||'),
array('FOO, BAR', '||FOO | BAR||'),
array('FOO , BAR', '||FOO | BAR||'),
array('FOO,BAR', '||FOO | BAR||'),
array(' ', null),
array(', ', null),
);
}
}
class TestableMappingModel extends MappingModel
{
public function getDefaultValueForArray($value)
{
return parent::getDefaultValueForArray($value);
}
public function appendXml(DOMNode $node)
{
}
protected function setupObject()
{
}
}