Ejemplo n.º 1
0
 function testItCanWriteLogCollection()
 {
     global $wpdb;
     $collection = new LoggerCollection();
     $collection->addLogger(new WpdbLogger());
     $event = new OptionEvent();
     $event->setBody('Hello World!');
     $event->setSeverity('notice');
     $event->setUserId('1');
     $collection->write($event);
     $row = $wpdb->get_row(sprintf('SELECT * FROM %s.%s', DB_NAME, $wpdb->prefix . 'wplog'));
     $this->assertNotEmpty($row);
     $this->assertStringStartsWith('Hello World', $row->body);
 }