Пример #1
0
 public function testUpdate()
 {
     $user = new User();
     $user->setArray(['name' => 'user1']);
     UserEntityManager::save($user);
     /** @var User $user */
     $user = UserEntityManager::find()->where('id', 1)->first();
     $user->name = 'person1';
     UserEntityManager::save($user);
     /** @var User $user */
     $user = UserEntityManager::find()->where('id', 1)->first();
     $this->assertEquals($user->id, 1);
     $this->assertEquals($user->name, 'person1');
 }
Пример #2
0
 public function testOrderDesc()
 {
     $user = UserEntityManager::find()->order(['id' => 'desc'])->first();
     $this->assertEquals($user->id, 2);
     $this->assertEquals($user->name, 'user2');
 }
Пример #3
0
 public function testNotDeleteUserByName()
 {
     UserEntityManager::delete(['name' => 'user']);
     $user = UserEntityManager::find()->where('name', 'user1')->first();
     $this->assertNotNull($user);
 }