/** * Tests the removeDuplicates method * * @return void * @covers ::removeDuplicates */ public function testRemoveDuplicates() { $data = ['type' => 'Foo', 'message' => 'some text']; $log = $this->Logs->newEntity($data); $res = $this->Logs->save($log); $this->assertTrue(!empty($res)); $data = ['type' => 'Bar', 'message' => 'some more text']; $log = $this->Logs->newEntity($data); $res = $this->Logs->save($log); $this->assertTrue(!empty($res)); $log = $this->Logs->newEntity($data); $res = $this->Logs->save($log); $this->assertTrue(!empty($res)); $resBefore = $this->Logs->find()->count(); $this->Logs->removeDuplicates(); $resAfter = $this->Logs->find()->count(); $this->assertSame($resBefore - 1, $resAfter); }