github.com/wawandco/oxplugins@v0.7.11/lifecycle/test/plugin_receiver.go (about)

     1  package test
     2  
     3  import "github.com/wawandco/oxplugins/plugins"
     4  
     5  // Receive takes BeforeTesters, AfterTesters and Testers
     6  // from the passed list of pugins and save those in the
     7  // instance of Command so these get used later on.
     8  func (b *Command) Receive(plugins []plugins.Plugin) {
     9  	for _, plugin := range plugins {
    10  
    11  		if ptool, ok := plugin.(BeforeTester); ok {
    12  			b.beforeTesters = append(b.beforeTesters, ptool)
    13  		}
    14  
    15  		if ptool, ok := plugin.(Tester); ok {
    16  			b.testers = append(b.testers, ptool)
    17  		}
    18  
    19  		if ptool, ok := plugin.(AfterTester); ok {
    20  			b.afterTesters = append(b.afterTesters, ptool)
    21  		}
    22  	}
    23  }