Example #1
0
 public function testShouldFindRecordByItsId()
 {
     $dao = $this->dao->get('Vegas\\Tests\\Stub\\Models\\FakeWithDao');
     $collection = new FakeWithDao();
     $collection->save();
     $id = $collection->getId();
     $found = $dao->findById($id);
     $this->assertInstanceOf('\\Vegas\\Tests\\Stub\\Models\\FakeWithDao', $found);
     $this->assertSame((string) $id, (string) $found->getId());
     $found->delete();
     $notFound = $dao->findById($id);
     $this->assertEmpty($notFound);
 }
Example #2
0
 public function testDaoDoesNotRequireChildModel()
 {
     $this->assertFalse(class_exists('\\Vegas\\Tests\\Stub\\Models\\StaticData'));
     $dao = $this->dao->get('\\Vegas\\Tests\\Stub\\Models\\StaticData');
     $this->assertInstanceOf('\\Vegas\\Tests\\Stub\\Models\\Dao\\StaticData', $dao);
     $staticData = ['foo' => 'bar', 'xyz' => 'zyx'];
     $this->assertSame($staticData, $dao->findAll());
 }