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