public function testSetAndGetEndpoint() { $endpoint = new Endpoint(); $endpoint->setKey('master'); $this->assertEquals($this->plugin, $this->plugin->setEndpoint($endpoint)); $this->assertEquals($endpoint, $this->plugin->getEndPoint()); }
/** * Create a endpoint instance * * If you supply a string as the first arguments ($options) it will be used as the key for the endpoint * and it will be registered. * If you supply an options array/object that contains a key the endpoint will also be registered. * * When no key is supplied the endpoint cannot be registered, in that case you will need to do this manually * after setting the key, by using the addEndpoint method. * * @param mixed $options * @param boolean $setAsDefault * @return Endpoint */ public function createEndpoint($options = null, $setAsDefault = false) { if (is_string($options)) { $endpoint = new Endpoint(); $endpoint->setKey($options); } else { $endpoint = new Endpoint($options); } if ($endpoint->getKey() !== null) { $this->addEndpoint($endpoint); if ($setAsDefault == true) { $this->setDefaultEndpoint($endpoint); } } return $endpoint; }