Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
GeneratorScriptsTest.php
Go to the documentation of this file.
1 <?php
2 namespace Ethereum;
3 
10 
11  /*
12  * Testing code generators
13  *
14  * Using --no-file-generation flag, run generation code,
15  * but not write files to disc.
16  */
17 
18  public function testGenerateComplexTypes()
19  {
20  $output = [];
21  $scriptSuccess = null;
22 
23  exec ($this->scriptCommand('generate-complex-datatypes'),$output,$scriptSuccess);
24  $this->assertSame(0, $scriptSuccess);
25  }
26 
27  public function testGenerateMethods()
28  {
29  $output = [];
30  $scriptSuccess = null;
31  exec ($this->scriptCommand('generate-methods'),$output,$scriptSuccess);
32  $this->assertSame(0, $scriptSuccess);
33  }
34 
35  private function scriptCommand($name)
36  {
37  $phpBin = exec('which php');
38 
39  if (!file_exists($phpBin) || !is_executable($phpBin)) {
40  throw new \Exception('Could not determine PHP exec.');
41  }
42 
43  return $phpBin . ' ' . str_replace(
44  'tests/CodeGenerators',
45  'scripts/' . $name . '.php --no-file-generation',
46  dirname(__FILE__)
47  );
48  }
49 
50 }
Definition: Abi.php:3