Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
EthBTest.php
Go to the documentation of this file.
1 <?php
2 namespace Ethereum;
5 
12 
18  public function testEthB__int_with_abi() {
19  $x = new EthB(1, array('abi' => 'bool'));
20  $this->assertSame($x->getSchemaType(), "B");
21  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000001');
22  $this->assertSame($x->val(), TRUE);
23  }
24 
30  public function testEthB__int() {
31  $x = new EthB(1);
32  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000001');
33  $this->assertSame($x->val(), TRUE);
34  }
35 
41  public function testEthB__int_null() {
42  $x = new EthB(0);
43  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000000');
44  $this->assertSame($x->val(), FALSE);
45  }
46 
52  public function testEthB__bool_true() {
53 
54  $x = new EthB(TRUE, array('abi' => 'bool'));
55 
56  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000001');
57  $this->assertSame($x->val(), TRUE);
58  }
59 
64  public function testEthB__bool_false() {
65  $x = new EthB(FALSE, array('abi' => 'bool'));
66  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000000');
67  $this->assertSame($x->val(), FALSE);
68  }
69 
75  public function testEthB__hex_false() {
76  $x = new EthB('0x0000000000000000000000000000000000000000000000000000000000000000');
77  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000000');
78  $this->assertSame($x->val(), FALSE);
79  }
80 
86  public function testEthB__hex_TRUE() {
87  $x = new EthB('0x0000000000000000000000000000000000000000000000000000000000000001', array('abi' => 'bool'));
88  $this->assertSame($x->hexVal(), '0x0000000000000000000000000000000000000000000000000000000000000001');
89  $this->assertSame($x->val(), TRUE);
90  }
91 
92 }
Definition: Abi.php:3