1 | <?php |
||
12 | class ColumnTypeGuesserTest extends CakeTestCase { |
||
13 | |||
14 | /** |
||
15 | * The faker instance |
||
16 | * |
||
17 | * @var null|Generator |
||
18 | */ |
||
19 | protected $_faker = null; |
||
20 | |||
21 | /** |
||
22 | * The object under test |
||
23 | * |
||
24 | * @var null|ColumnTypeGuesser |
||
25 | */ |
||
26 | protected $_guesser = null; |
||
27 | |||
28 | /** |
||
29 | * Setup the object under test |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | public function setUp() { |
||
39 | |||
40 | /** |
||
41 | * Test the constructor |
||
42 | * |
||
43 | * @return void |
||
44 | * @covers ::__construct |
||
45 | */ |
||
46 | public function testConstruct() { |
||
50 | |||
51 | /** |
||
52 | * Tests the guessFormat method with various types |
||
53 | * |
||
54 | * @param string $magicMethod The name of the magic method (__call or __get). |
||
55 | * @param string $method The name of the method (e.g. randomNumber). |
||
56 | * @param array $column The column schema with type etc. |
||
57 | * @return void |
||
58 | * @covers ::guessFormat |
||
59 | * @dataProvider formatProvider |
||
60 | */ |
||
61 | public function testGuessFormats($magicMethod, $method, $column) { |
||
68 | |||
69 | /** |
||
70 | * Tests the guessFormat method with various types resulting to null |
||
71 | * |
||
72 | * @param null|array $column The column schema with type etc. |
||
73 | * @return void |
||
74 | * @covers ::guessFormat |
||
75 | * @dataProvider specialFormatProvider |
||
76 | */ |
||
77 | public function testGuessSpecialFormat($column) { |
||
81 | |||
82 | /** |
||
83 | * A format data provider |
||
84 | * |
||
85 | * @return array Formats |
||
86 | */ |
||
87 | public function formatProvider() { |
||
104 | |||
105 | /** |
||
106 | * A format data provider for resulting to null cases |
||
107 | * |
||
108 | * @return array Formats |
||
109 | */ |
||
110 | public function specialFormatProvider() { |
||
120 | } |
||
121 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: