本文整理匯總了PHP中Wire::setSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wire::setSource方法的具體用法?PHP Wire::setSource怎麽用?PHP Wire::setSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wire
的用法示例。
在下文中一共展示了Wire::setSource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setsSource
/**
* @test
* @cover ::setSource
*/
public function setsSource()
{
$wire = new Wire('test');
$source = \Mockery::mock('\\Hamdrew\\AdventOfCode\\Day7\\CircuitComponent');
$wire->setSource($source);
$this->assertSame($source, $wire->getSource());
}
示例2: parsesAndGateWithTwoSignals
/**
* @test
* @covers ::parse
* @covers ::getWireOrSignalGenerator
* @covers ::getWire
* @covers ::parseAndOrGate
*/
public function parsesAndGateWithTwoSignals()
{
$input = "1 AND cx -> cy";
$signal = new SignalGenerator(1);
$wireCx = new Wire('cx');
$andGate = new GateAnd($signal, $wireCx);
$wireCy = new Wire('cy');
$wireCy->setSource($andGate);
$components = [$signal, $wireCx, $wireCy, $andGate];
$circuit = new Circuit($components);
$parsedCircuit = CircuitInstructionParser::parse($input);
$this->assertTrue($circuit->equals($parsedCircuit));
}