public function testAccessors() { $element = new TestElement(1); $element->fill(['ID' => 2, 'NAME' => 'John', 'ACCESSOR_ONE' => 'foo']); $this->assertSame('!foo!', $element['ACCESSOR_ONE']); $this->assertTrue(isset($element['ACCESSOR_ONE'])); $this->assertTrue(!empty($element['ACCESSOR_ONE'])); $this->assertSame('2:John', $element['ACCESSOR_TWO']); $this->assertTrue(isset($element['ACCESSOR_TWO'])); $this->assertTrue(!empty($element['ACCESSOR_TWO'])); $this->assertSame([], $element['ACCESSOR_THREE']); $this->assertTrue(isset($element['ACCESSOR_THREE'])); $this->assertFalse(!empty($element['ACCESSOR_THREE'])); }
public function testStopActionFromScope() { $bxObject = m::mock('object'); TestElement::$bxObject = $bxObject; $query = $this->createQuery($bxObject); $items = $query->filter(['NAME' => 'John'])->stopActionScope()->getList(); $this->assertSame((new Collection())->all(), $items->all()); $query = $this->createQuery($bxObject); $item = $query->filter(['NAME' => 'John'])->stopActionScope()->getById(1); $this->assertSame(false, $item); $query = $this->createQuery($bxObject); $count = $query->filter(['NAME' => 'John'])->stopActionScope()->count(); $this->assertSame(0, $count); }