コード例 #1
0
 /**
  * @test
  * @dataProvider items
  */
 public function reverting_transaction()
 {
     $this->givenDatabaseIsClear();
     $this->getEntityManager()->beginTransaction();
     $this->add(new Teapot('brand-new-teapot', 10.0));
     $this->add(new Phone('amazing-phone', 400.0));
     $items = ItemRepository::create($this->getEntityManager())->paginate(1, 2);
     $this->assertCount(2, $items);
     $this->getEntityManager()->rollback();
 }
 /**
  * @param EntityManager $objectManager
  */
 private function __construct(EntityManager $objectManager)
 {
     $this->entityManager = $objectManager;
     $this->items = ItemRepository::create($objectManager);
 }
コード例 #3
0
 protected function givenSqliteDatabaseWasConnected()
 {
     $this->entityManager = EntityManagerFactory::create(SqliteConfig::getParams());
     $this->items = ItemRepository::create($this->getEntityManager());
 }
コード例 #4
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  * @dataProvider invalidArguments
  */
 public function it_fails_with_invalid_arguments($page, $itemsPerPage)
 {
     $this->givenDatabaseIsClear();
     $this->add(new Teapot('new-teapot', 100.3));
     ItemRepository::create($this->getEntityManager())->paginate($page, $itemsPerPage);
 }