Example #1
0
 public function testGetByEmail()
 {
     $bxObject = m::mock('object');
     TestUser::$bxObject = $bxObject;
     $bxObject->shouldReceive('getList')->with(['SORT' => 'ASC'], false, ['EMAIL' => '*****@*****.**'], ['SELECT' => false, 'NAV_PARAMS' => ['nPageSize' => 1], 'FIELDS' => ['ID', 'NAME']])->once()->andReturn(m::self());
     $bxObject->shouldReceive('fetch')->times(2)->andReturn(['ID' => 1, 'NAME' => 'foo'], false);
     $query = $this->createQuery($bxObject);
     $item = $query->sort(['SORT' => 'ASC'])->select('ID', 'NAME')->getByEmail('*****@*****.**');
     $this->assertSame(['ID' => 1, 'NAME' => 'foo'], $item->toArray());
 }
Example #2
0
 public function testFillGroups()
 {
     $user = new TestUser(1);
     $user->fillGroups([1, 2]);
     $this->assertSame(1, $user->id);
     $this->assertSame(['GROUP_ID' => [1, 2]], $user->fields);
     $this->assertSame([1, 2], $user->getGroups());
 }