private function validateTransformer($model, $method, $returnValue = null) { $this->transformerRegistry->expects($this->once())->method('get' . $model . 'Transformer'); $transformer = $this->transformers[$model]; $transformer = $transformer->expects($this->once())->method($method); if (null !== $returnValue) { $transformer->will($this->returnValue($returnValue)); } }
public final function __construct(array $config) { // create the transformation layer $this->transformers = $this->createTransformerRegistry(); $this->transformers->setCloudTransformer($this->createCloudTransformer()); $this->transformers->setEncodingTransformer($this->createEncodingTransformer()); $this->transformers->setNotificationsTransformer($this->createNotificationsTransformer()); $this->transformers->setProfileTransformer($this->createProfileTransformer()); $this->transformers->setVideoTransformer($this->createVideoTransformer()); // register the accounts $this->accountManager = $this->createAccountManager(); $this->accountManager->setDefaultAccount(isset($config['default_account']) ? $config['default_account'] : 'default'); $this->processAccountConfig($config); // register the clouds $this->cloudManager = $this->createCloudManager(); $this->cloudManager->setDefaultCloud(isset($config['default_cloud']) ? $config['default_cloud'] : 'default'); $this->processCloudConfig($config); }
private function doCreateEncoding(array $params) { $response = $this->httpClient->post('/encodings.json', $params); $transformer = $this->transformers->getEncodingTransformer(); return $transformer->stringToEncoding($response); }