Example #1
0
 /**
  * @expectedException RuntimeException
  */
 public function testGetForWithNoSupportingStorage()
 {
     $storage = $this->getStorageMock();
     $storage->expects($this->any())->method('supports')->will($this->returnValue(false));
     $manager = new StorageManager();
     $manager->register($storage);
     $manager->getFor(new \stdClass());
 }
Example #2
0
 public function setUp()
 {
     $this->storage = new Storage\Stub();
     $storageManager = new StorageManager();
     $storageManager->register($this->storage);
     $factoryManager = new FactoryManager();
     $factoryManager->set('user', function ($values) {
         $user = new Fixtures\User();
         $user->setUsername($values->get('username', 'John'));
         return $user;
     });
     $factoryManager->set('article', function ($values) {
         $article = new Fixtures\Article();
         $article->setTitle($values->get('title', 'The article'));
         $article->setAuthor($values->getRelation('author', 'user'));
         return $article;
     });
     $this->environment = new Environment($factoryManager, $storageManager);
 }