@@ -13,112 +13,112 @@ |
||
13 | 13 | */ |
14 | 14 | class DataProviderTest extends \PHPUnit_Framework_TestCase |
15 | 15 | { |
16 | - public function testRunExecutePopulate() |
|
17 | - { |
|
18 | - $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
16 | + public function testRunExecutePopulate() |
|
17 | + { |
|
18 | + $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
19 | 19 | |
20 | - $provider |
|
21 | - ->expects($this->once()) |
|
22 | - ->method('populate') |
|
23 | - ; |
|
20 | + $provider |
|
21 | + ->expects($this->once()) |
|
22 | + ->method('populate') |
|
23 | + ; |
|
24 | 24 | |
25 | - $provider->run( |
|
26 | - $this->getClient(), |
|
27 | - 'index', |
|
28 | - 'type', |
|
29 | - $this->getMock(EventDispatcherInterface::class) |
|
30 | - ); |
|
31 | - } |
|
25 | + $provider->run( |
|
26 | + $this->getClient(), |
|
27 | + 'index', |
|
28 | + 'type', |
|
29 | + $this->getMock(EventDispatcherInterface::class) |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | - private function getClient() |
|
34 | - { |
|
35 | - return $this |
|
36 | - ->getMockBuilder(Client::class) |
|
37 | - ->disableOriginalConstructor() |
|
38 | - ->getMock() |
|
39 | - ; |
|
40 | - } |
|
33 | + private function getClient() |
|
34 | + { |
|
35 | + return $this |
|
36 | + ->getMockBuilder(Client::class) |
|
37 | + ->disableOriginalConstructor() |
|
38 | + ->getMock() |
|
39 | + ; |
|
40 | + } |
|
41 | 41 | |
42 | - public function testIndexWithIndexAndType() |
|
43 | - { |
|
44 | - $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
42 | + public function testIndexWithIndexAndType() |
|
43 | + { |
|
44 | + $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
45 | 45 | |
46 | - $client = $this->getClient(); |
|
47 | - $client |
|
48 | - ->expects($this->once()) |
|
49 | - ->method('bulk') |
|
50 | - ->with([ |
|
46 | + $client = $this->getClient(); |
|
47 | + $client |
|
48 | + ->expects($this->once()) |
|
49 | + ->method('bulk') |
|
50 | + ->with([ |
|
51 | 51 | 'body' => |
52 | 52 | [ |
53 | - [ |
|
54 | - 'index' => [ |
|
55 | - '_index' => 'my_index', |
|
56 | - '_type' => 'my_type', |
|
57 | - '_id' => 'my_id', |
|
58 | - ] |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'foo' => 'bar', |
|
62 | - ] |
|
53 | + [ |
|
54 | + 'index' => [ |
|
55 | + '_index' => 'my_index', |
|
56 | + '_type' => 'my_type', |
|
57 | + '_id' => 'my_id', |
|
58 | + ] |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'foo' => 'bar', |
|
62 | + ] |
|
63 | 63 | ] |
64 | - ] |
|
65 | - ); |
|
64 | + ] |
|
65 | + ); |
|
66 | 66 | |
67 | - $provider |
|
68 | - ->expects($this->once()) |
|
69 | - ->method('populate') |
|
70 | - ->will( |
|
67 | + $provider |
|
68 | + ->expects($this->once()) |
|
69 | + ->method('populate') |
|
70 | + ->will( |
|
71 | 71 | $this->returnCallback( |
72 | - function () use ($provider) { |
|
73 | - $provider->index( |
|
74 | - 'my_id', |
|
75 | - ['foo' => 'bar'] |
|
76 | - ); |
|
77 | - } |
|
72 | + function () use ($provider) { |
|
73 | + $provider->index( |
|
74 | + 'my_id', |
|
75 | + ['foo' => 'bar'] |
|
76 | + ); |
|
77 | + } |
|
78 | 78 | ) |
79 | - ) |
|
80 | - ; |
|
79 | + ) |
|
80 | + ; |
|
81 | 81 | |
82 | - $provider->run( |
|
83 | - $client, |
|
84 | - 'my_index', |
|
85 | - 'my_type', |
|
86 | - $this->getMock(EventDispatcherInterface::class) |
|
87 | - ); |
|
88 | - } |
|
82 | + $provider->run( |
|
83 | + $client, |
|
84 | + 'my_index', |
|
85 | + 'my_type', |
|
86 | + $this->getMock(EventDispatcherInterface::class) |
|
87 | + ); |
|
88 | + } |
|
89 | 89 | |
90 | - public function testIndexRunBulkTwiceIfMoreThanBatchSize() |
|
91 | - { |
|
92 | - $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
90 | + public function testIndexRunBulkTwiceIfMoreThanBatchSize() |
|
91 | + { |
|
92 | + $provider = $this->getMockForAbstractClass(DataProvider::class); |
|
93 | 93 | |
94 | - $client = $this->getClient(); |
|
95 | - $client |
|
96 | - ->expects($this->exactly(2)) |
|
97 | - ->method('bulk') |
|
98 | - ; |
|
94 | + $client = $this->getClient(); |
|
95 | + $client |
|
96 | + ->expects($this->exactly(2)) |
|
97 | + ->method('bulk') |
|
98 | + ; |
|
99 | 99 | |
100 | - $provider |
|
101 | - ->expects($this->once()) |
|
102 | - ->method('populate') |
|
103 | - ->will( |
|
100 | + $provider |
|
101 | + ->expects($this->once()) |
|
102 | + ->method('populate') |
|
103 | + ->will( |
|
104 | 104 | $this->returnCallback( |
105 | - function () use ($provider) { |
|
106 | - for($i = 0; $i < 1500; $i++) { |
|
107 | - $provider->index( |
|
105 | + function () use ($provider) { |
|
106 | + for($i = 0; $i < 1500; $i++) { |
|
107 | + $provider->index( |
|
108 | 108 | 'my_id', |
109 | 109 | ['foo' => 'bar'] |
110 | - ); |
|
111 | - } |
|
112 | - } |
|
110 | + ); |
|
111 | + } |
|
112 | + } |
|
113 | + ) |
|
113 | 114 | ) |
114 | - ) |
|
115 | - ; |
|
115 | + ; |
|
116 | 116 | |
117 | - $provider->run( |
|
118 | - $client, |
|
119 | - 'my_index', |
|
120 | - 'my_type', |
|
121 | - $this->getMock(EventDispatcherInterface::class) |
|
122 | - ); |
|
123 | - } |
|
117 | + $provider->run( |
|
118 | + $client, |
|
119 | + 'my_index', |
|
120 | + 'my_type', |
|
121 | + $this->getMock(EventDispatcherInterface::class) |
|
122 | + ); |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ->method('populate') |
70 | 70 | ->will( |
71 | 71 | $this->returnCallback( |
72 | - function () use ($provider) { |
|
72 | + function() use ($provider) { |
|
73 | 73 | $provider->index( |
74 | 74 | 'my_id', |
75 | 75 | ['foo' => 'bar'] |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | ->method('populate') |
103 | 103 | ->will( |
104 | 104 | $this->returnCallback( |
105 | - function () use ($provider) { |
|
106 | - for($i = 0; $i < 1500; $i++) { |
|
105 | + function() use ($provider) { |
|
106 | + for ($i = 0; $i < 1500; $i++) { |
|
107 | 107 | $provider->index( |
108 | 108 | 'my_id', |
109 | 109 | ['foo' => 'bar'] |