Gerçekten bununla bir tuğla duvara koşuyorum. Phpunit'teki testler arasında sınıf değerlerini nasıl geçersiniz?phpunit: Testler arasında değerleri nasıl geçebilirim?
Testi 1 -> setleri değeri,
Testi 2 -> Burada değerini
okur benim kodudur:
class JsonRpcBitcoinTest extends PHPUnit_Framework_TestCase
{
public function setUp(){
global $configRpcUser, $configRpcPass, $configRpcHost, $configRpcPort;
$this->bitcoindConn = new JsonRpcBitcoin($configRpcUser, $configRpcPass, $configRpcHost, $configRpcPort);
$this->blockHash = '';
}
/**
* @depends testCanAuthenticateToBitcoindWithGoodCred
*/
public function testCmdGetBlockHash()
{
$result = (array)json_decode($this->bitcoindConn->getblockhash(20));
$this->blockHash = $result['result'];
$this->assertNotNull($result['result']);
}
/**
* @depends testCmdGetBlockHash
*/
public function testCmdGetBlock()
{
$result = (array)json_decode($this->bitcoindConn->getblock($this->blockHash));
$this->assertEquals($result['error'], $this->blockHash);
}
}
testCmdGetBlock()
ayarlanmış olmalıdır
$this->blockHash
değerini almıyor
testCmdGetBlockHash()
. Neyin yanlış olduğunun anlaşılmasında yardımcı olunması çok takdir edilecektir.
Fantastic! Çok teşekkür ederim, bunu nasıl almadığım hakkında hiçbir fikrim yok. – Drazisil