Completed
Push — master ( b8b393...c56780 )
by GBProd
02:34
created
tests/ElasticsearchDataProviderBundle/DataProvider/DataProviderTest.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -13,122 +13,122 @@
 block discarded – undo
13 13
  */
14 14
 class DataProviderTest extends \PHPUnit_Framework_TestCase
15 15
 {
16
-   public function testRunExecutePopulate()
17
-   {
18
-      $provider = $this->getMockForAbstractClass(DataProvider::class);
19
-
20
-      $provider
21
-         ->expects($this->once())
22
-         ->method('populate')
23
-      ;
24
-
25
-      $provider->run(
26
-         $this->getClient(),
27
-         'index',
28
-         'type',
29
-         $this->getMock(EventDispatcherInterface::class)
30
-      );
31
-   }
32
-
33
-   /**
34
-    * @return Client
35
-    */
36
-   private function getClient()
37
-   {
38
-      return $this
39
-         ->getMockBuilder(Client::class)
40
-         ->disableOriginalConstructor()
41
-         ->getMock()
42
-      ;
43
-   }
44
-
45
-   public function testIndexWithIndexAndType()
46
-   {
47
-      $provider = $this->getMockForAbstractClass(DataProvider::class);
48
-
49
-      $client = $this->getClient();
50
-      $client
51
-         ->expects($this->once())
52
-         ->method('bulk')
53
-         ->with([
16
+    public function testRunExecutePopulate()
17
+    {
18
+        $provider = $this->getMockForAbstractClass(DataProvider::class);
19
+
20
+        $provider
21
+            ->expects($this->once())
22
+            ->method('populate')
23
+        ;
24
+
25
+        $provider->run(
26
+            $this->getClient(),
27
+            'index',
28
+            'type',
29
+            $this->getMock(EventDispatcherInterface::class)
30
+        );
31
+    }
32
+
33
+    /**
34
+     * @return Client
35
+     */
36
+    private function getClient()
37
+    {
38
+        return $this
39
+            ->getMockBuilder(Client::class)
40
+            ->disableOriginalConstructor()
41
+            ->getMock()
42
+        ;
43
+    }
44
+
45
+    public function testIndexWithIndexAndType()
46
+    {
47
+        $provider = $this->getMockForAbstractClass(DataProvider::class);
48
+
49
+        $client = $this->getClient();
50
+        $client
51
+            ->expects($this->once())
52
+            ->method('bulk')
53
+            ->with([
54 54
             'body' =>
55 55
             [
56
-               [
57
-                  'index' => [
58
-                      '_index' => 'my_index',
59
-                      '_type'  => 'my_type',
60
-                      '_id'    => 'my_id',
61
-                  ]
62
-               ],
63
-               [
64
-                  'foo' => 'bar',
65
-               ]
56
+                [
57
+                    'index' => [
58
+                        '_index' => 'my_index',
59
+                        '_type'  => 'my_type',
60
+                        '_id'    => 'my_id',
61
+                    ]
62
+                ],
63
+                [
64
+                    'foo' => 'bar',
65
+                ]
66 66
             ]
67
-         ]
68
-      );
67
+            ]
68
+        );
69 69
 
70
-      $provider
71
-         ->expects($this->once())
72
-         ->method('populate')
73
-         ->will(
70
+        $provider
71
+            ->expects($this->once())
72
+            ->method('populate')
73
+            ->will(
74 74
             $this->returnCallback(
75
-               function () use ($provider) {
76
-                  $provider->index(
77
-                     'my_id',
78
-                     ['foo' => 'bar']
79
-                  );
80
-               }
75
+                function () use ($provider) {
76
+                    $provider->index(
77
+                        'my_id',
78
+                        ['foo' => 'bar']
79
+                    );
80
+                }
81 81
             )
82
-         )
83
-      ;
84
-
85
-      $provider->run(
86
-         $client,
87
-         'my_index',
88
-         'my_type',
89
-         $this->getMock(EventDispatcherInterface::class)
90
-      );
91
-   }
92
-
93
-   public function testIndexRunBulkTwiceIfMoreThanBatchSize()
94
-   {
95
-      $provider = $this->getMockForAbstractClass(DataProvider::class);
96
-
97
-      $client = $this->getClient();
98
-      $client
99
-         ->expects($this->exactly(2))
100
-         ->method('bulk')
101
-      ;
102
-
103
-      $provider
104
-         ->expects($this->once())
105
-         ->method('populate')
106
-         ->will(
82
+            )
83
+        ;
84
+
85
+        $provider->run(
86
+            $client,
87
+            'my_index',
88
+            'my_type',
89
+            $this->getMock(EventDispatcherInterface::class)
90
+        );
91
+    }
92
+
93
+    public function testIndexRunBulkTwiceIfMoreThanBatchSize()
94
+    {
95
+        $provider = $this->getMockForAbstractClass(DataProvider::class);
96
+
97
+        $client = $this->getClient();
98
+        $client
99
+            ->expects($this->exactly(2))
100
+            ->method('bulk')
101
+        ;
102
+
103
+        $provider
104
+            ->expects($this->once())
105
+            ->method('populate')
106
+            ->will(
107 107
             $this->returnCallback(
108
-               function () use ($provider) {
109
-                  for($i = 0; $i < 1500; $i++) {
110
-                     $provider->index(
108
+                function () use ($provider) {
109
+                    for($i = 0; $i < 1500; $i++) {
110
+                        $provider->index(
111 111
                         'my_id',
112 112
                         ['foo' => 'bar']
113
-                     );
114
-                  }
115
-               }
113
+                        );
114
+                    }
115
+                }
116
+            )
116 117
             )
117
-         )
118
-      ;
119
-
120
-      $provider->run(
121
-         $client,
122
-         'my_index',
123
-         'my_type',
124
-         $this->getMock(EventDispatcherInterface::class)
125
-      );
126
-   }
127
-
128
-   public function testCountIsNull()
129
-   {
130
-      $provider = $this->getMockForAbstractClass(DataProvider::class);
131
-
132
-      $this->assertNull($provider->count());
133
-   }
118
+        ;
119
+
120
+        $provider->run(
121
+            $client,
122
+            'my_index',
123
+            'my_type',
124
+            $this->getMock(EventDispatcherInterface::class)
125
+        );
126
+    }
127
+
128
+    public function testCountIsNull()
129
+    {
130
+        $provider = $this->getMockForAbstractClass(DataProvider::class);
131
+
132
+        $this->assertNull($provider->count());
133
+    }
134 134
 }
Please login to merge, or discard this patch.