Elgg\Logger::disable PHP Méthode

disable() public méthode

Call disable() before your tests and enable() after. enable() will return a list of calls to log() (and helper methods) that were not acted upon.
See also: enable
public disable ( ) : void
Résultat void
    public function disable()
    {
        $this->disabled_stack[] = [];
    }

Usage Example

Exemple #1
0
 /**
  * @group IconService
  */
 public function testCanCleanUpOnFailure()
 {
     $service = $this->createService();
     $file = new \ElggFile();
     $file->owner_guid = 1;
     $file->setFilename('400x300.gif');
     $file->mimetype = 'image/gif';
     $service->saveIconFromElggFile($this->entity, $file);
     $this->assertTrue($service->hasIcon($this->entity, 'master'));
     $this->assertTrue($service->hasIcon($this->entity, 'large'));
     $this->assertTrue($service->hasIcon($this->entity, 'medium'));
     $this->assertTrue($service->hasIcon($this->entity, 'small'));
     $this->assertTrue($service->hasIcon($this->entity, 'tiny'));
     $this->assertTrue($service->hasIcon($this->entity, 'topbar'));
     $this->logger->disable();
     // This will fail for square icons because cropping coordinates are not square
     $service->saveIconFromElggFile($this->entity, $file, 'icon', ['x1' => 0, 'y1' => 0, 'x2' => 10, 'y2' => 20]);
     $this->logger->enable();
     $this->assertFalse($service->hasIcon($this->entity, 'master'));
     $this->assertFalse($service->hasIcon($this->entity, 'large'));
     $this->assertFalse($service->hasIcon($this->entity, 'medium'));
     $this->assertFalse($service->hasIcon($this->entity, 'small'));
     $this->assertFalse($service->hasIcon($this->entity, 'tiny'));
     $this->assertFalse($service->hasIcon($this->entity, 'topbar'));
 }
All Usage Examples Of Elgg\Logger::disable