public function testCount() { $bxObject = m::mock('object'); $bxObject->shouldReceive('getList')->with(false, ['ACTIVE' => 'Y', 'IBLOCK_ID' => 1], [])->once()->andReturn(2); TestElement::$bxObject = $bxObject; $this->assertEquals(2, TestElement::count(['ACTIVE' => 'Y', 'IBLOCK_ID' => 1])); $bxObject = m::mock('object'); $bxObject->shouldReceive('getList')->with(false, ['IBLOCK_ID' => 1], [])->once()->andReturn(3); TestElement::$bxObject = $bxObject; $this->assertSame(3, TestElement::count()); }
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); }