@@ -54,40 +54,45 @@ protected function setUp()
54
54
}
55
55
56
56
/**
57
+ * @param bool $expectedResult
57
58
* @param array $value
58
59
* @dataProvider isValidSuccessDataProvider
59
60
*/
60
- public function testIsValidSuccess ($ value )
61
+ public function testIsValidSuccess ($ expectedResult , array $ value )
61
62
{
62
- $ value = [
63
- 'price_type ' => 'fixed ' ,
64
- 'price ' => '10 ' ,
65
- 'title ' => 'Some Title ' ,
66
- ];
67
63
$ this ->valueMock ->expects ($ this ->once ())->method ('getTitle ' )->will ($ this ->returnValue ('option_title ' ));
68
64
$ this ->valueMock ->expects ($ this ->exactly (2 ))->method ('getType ' )->will ($ this ->returnValue ('name 1.1 ' ));
69
65
$ this ->valueMock ->expects ($ this ->never ())->method ('getPriceType ' );
70
66
$ this ->valueMock ->expects ($ this ->never ())->method ('getPrice ' );
71
67
$ this ->valueMock ->expects ($ this ->any ())->method ('getData ' )->with ('values ' )->will ($ this ->returnValue ([$ value ]));
72
- $ this ->assertTrue ($ this ->validator ->isValid ($ this ->valueMock ));
73
- $ this ->assertEmpty ($ this ->validator ->getMessages ());
68
+ $ this ->assertEquals ($ expectedResult , $ this ->validator ->isValid ($ this ->valueMock ));
74
69
}
75
70
76
71
public function isValidSuccessDataProvider ()
77
72
{
78
- $ value = [
79
- 'price_type ' => 'fixed ' ,
80
- 'price ' => '10 ' ,
81
- 'title ' => 'Some Title ' ,
82
- ];
83
-
84
- $ valueWithoutAllData = [
85
- 'some_data ' => 'data ' ,
86
- ];
87
-
88
73
return [
89
- 'all_data ' => [$ value ],
90
- 'not_all_data ' => [$ valueWithoutAllData ]
74
+ [
75
+ true ,
76
+ [
77
+ 'price_type ' => 'fixed ' ,
78
+ 'price ' => '10 ' ,
79
+ 'title ' => 'Some Title ' ,
80
+ ]
81
+ ],
82
+ [
83
+ true ,
84
+ [
85
+ 'title ' => 'Some Title ' ,
86
+ ]
87
+ ],
88
+ [
89
+ false ,
90
+ [
91
+ 'title ' => 'Some Title ' ,
92
+ 'price_type ' => 'fixed ' ,
93
+ 'price ' => -10 ,
94
+ ]
95
+ ],
91
96
];
92
97
}
93
98
0 commit comments