本文整理汇总了PHP中Reference::backwards方法的典型用法代码示例。如果您正苦于以下问题:PHP Reference::backwards方法的具体用法?PHP Reference::backwards怎么用?PHP Reference::backwards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::backwards方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBackwards
public function testBackwards()
{
$row = $this->getMockBuilder(Row::class)->disableOriginalConstructor()->getMock();
$row->expects($this->once())->method('getPrimaryKey')->will($this->returnValue('film_id'));
$row->expects($this->once())->method('offsetGet')->will($this->returnValue(-1));
$query = $this->getMockBuilder(Query\Select::class)->disableOriginalConstructor()->getMock();
$row->expects($this->once())->method('getQuery')->will($this->returnValue($query));
$table = $this->getMockBuilder(Table::class)->disableOriginalConstructor()->getMock();
$table->expects($this->once())->method('getRows')->will($this->returnValue([new Row($table, self::$filmCategories[0]), new Row($table, self::$filmCategories[1])]));
$reference = new Reference($row, $table);
$rows = $reference->backwards();
$this->assertEquals(2, count($rows));
$i = 0;
foreach ($rows as $row) {
$expected = self::$filmCategories[$i++];
$this->assertInstanceOf(Row::class, $row);
$this->assertEquals($expected, $row->toArray());
}
}