Trying to apply a custom plugin; getting a MissingMethodException on project.apply plugin: 'myPlugin'. What method am I missing?

Hello, I am getting a MissingMethodException on project.apply plugin: ‘x’. What method am I missing?

Error

org.gradle.api.internal.MissingMethodException at EnvPluginTest.groovy:13

Test Code

package com.gradle.env;
  import static org.junit.Assert.*
import org.junit.Test
import org.gradle.api.*
import org.gradle.testfixtures.*
  class EnvPluginTest {
   @Test
 public void envPluginAddsEnvPluginExtensionToProject() {
  Project project =
ProjectBuilder.builder().build()
  project.apply plugin: 'env'
    assertTrue(project.extensions.getByName('env')
     instanceof
EnvPluginExtension)
 }
}

The full stack trace (e.g. from the HTML report or your IDE) should tell you.