Пример #1
0
 function testSpecifyCredentials()
 {
     $configuration = new Configuration(array('username' => 'foobar', 'password' => 'baz'));
     $transport = new Transport\Curl(self::host, self::port);
     $transport->setAuth('foobar', 'baz');
     $this->assertEquals(new Client($transport), $configuration->getClient());
 }
Пример #2
0
 /**
  * Initialize the entity manager using the provided configuration.
  *
  * Configuration options are detailed in the Configuration class, and can be passed as an array of values instead
  * of a Configuration object.
  * 
  * @param Configuration|array $configuration Various information about how the entity manager should behave.
  * @throws Exception Thrown when argument is not a configuration object or array.
  */
 public function __construct($configuration = null)
 {
     //Check if there was a configuration provided
     if (is_null($configuration)) {
         //Create a new default config
         $configuration = new Configuration();
     } elseif (is_array($configuration)) {
         $configuration = new Configuration($configuration);
     } elseif (!$configuration instanceof Configuration) {
         //Not a configuration object
         throw new Exception('Provided argument must be a Configuration object or an array.');
     }
     //Get a proxy factory
     $this->proxyFactory = $configuration->getProxyFactory();
     //Get the database connection from the client
     $this->client = $configuration->getClient();
     //Get a meta repository from the configuration
     $this->metaRepository = $configuration->getMetaRepository();
     //Get the date generator function to use
     $this->dateGenerator = $configuration->getDateGenerator();
 }