shh_addToGroup

This commit is contained in:
sc0Vu 2018-01-26 17:27:55 +08:00
parent f6a7ffebdb
commit f5286c0398
3 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,61 @@
<?php
/**
* This file is part of web3.php package.
*
* (c) Kuan-Cheng,Lai <alk03073135@gmail.com>
*
* @author Peter Lai <alk03073135@gmail.com>
* @license MIT
*/
namespace Web3\Methods\Shh;
use InvalidArgumentException;
use Web3\Methods\EthMethod;
use Web3\Validators\IdentityValidator;
class AddToGroup extends EthMethod
{
/**
* validators
*
* @var array
*/
protected $validators = [
IdentityValidator::class
];
/**
* inputFormatters
*
* @var array
*/
protected $inputFormatters = [];
/**
* outputFormatters
*
* @var array
*/
protected $outputFormatters = [];
/**
* defaultValues
*
* @var array
*/
protected $defaultValues = [];
/**
* construct
*
* @param string $method
* @param array $arguments
* @return void
*/
// public function __construct($method='', $arguments=[])
// {
// parent::__construct($method, $arguments);
// }
}

View File

@ -39,7 +39,7 @@ class Shh
*/
private $allowedMethods = [
'shh_version', 'shh_newIdentity', 'shh_hasIdentity',
// doesn't exist: 'shh_newGroup'
// doesn't exist: 'shh_newGroup', 'shh_addToGroup'
];
/**

View File

@ -111,6 +111,33 @@ class ShhApiTest extends TestCase
// });
// }
/**
* testAddToGroup
*
* @return void
*/
// public function testAddToGroup()
// {
// $shh = $this->shh;
// $newIdentity = '';
// $shh->newIdentity(function ($err, $identity) use (&$newIdentity) {
// if ($err !== null) {
// return $this->fail($err->getMessage());
// }
// $newIdentity = $identity;
// $this->assertEquals(mb_strlen($identity), 132);
// });
// $shh->addToGroup($newIdentity, function ($err, $hasAdded) {
// if ($err !== null) {
// return $this->fail($err->getMessage());
// }
// $this->assertTrue($hasAdded);
// });
// }
/**
* testWrongParam
* We transform data and throw invalid argument exception