truncate() public method

truncate()
public truncate ( ) : void
return void
 public function testEncodeParamsAssocFalse()
 {
     // $depth param added in 5.5.0
     $this->skipIf(!version_compare(PHP_VERSION, '5.5.0', '>='));
     // Test encode depth = 1
     $this->Comments->removeBehavior('Jsonable');
     $this->Comments->addBehavior('Tools.Jsonable', ['fields' => ['details'], 'encodeParams' => ['depth' => 1], 'decodeParams' => ['assoc' => false]]);
     $data = ['comment' => 'blabla', 'url' => 'www.dereuromark.de', 'title' => 'param', 'details' => ['y' => 'yy']];
     $entity = $this->Comments->newEntity($data);
     $this->Comments->save($entity);
     $res = $this->Comments->find('all', ['conditions' => ['title' => 'param']])->first();
     $obj = new stdClass();
     $obj->y = 'yy';
     $expected = $obj;
     $this->assertEquals($expected, $res['details']);
     $this->Comments->truncate();
     $this->Comments->removeBehavior('Jsonable');
     $this->Comments->addBehavior('Tools.Jsonable', ['fields' => ['details'], 'encodeParams' => ['depth' => 1], 'decodeParams' => ['assoc' => false]]);
     $data = ['comment' => 'blabla', 'url' => 'www.dereuromark.de', 'title' => 'param', 'details' => ['y' => ['yy' => 'yyy']]];
     $entity = $this->Comments->newEntity($data);
     $this->Comments->save($entity);
     $res = $this->Comments->find('all', ['conditions' => ['title' => 'param']])->first();
     $expected = null;
     $this->assertEquals($expected, $res['details']);
 }