Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-06-30 13:37:18 +00:00 committed by StyleCI Bot
parent 70a85cb6be
commit dddad90616
2 changed files with 31 additions and 31 deletions

View File

@ -669,15 +669,15 @@ class MTProto extends \Volatile
'layer' => $this->settings['tl_schema']['layer'], 'layer' => $this->settings['tl_schema']['layer'],
'query' => $this->serialize_method('initConnection', 'query' => $this->serialize_method('initConnection',
[ [
'api_id' => $this->settings['app_info']['api_id'], 'api_id' => $this->settings['app_info']['api_id'],
'api_hash' => $this->settings['app_info']['api_hash'], 'api_hash' => $this->settings['app_info']['api_hash'],
'device_model' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['device_model'] : 'n/a', 'device_model' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['device_model'] : 'n/a',
'system_version' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['system_version'] : 'n/a', 'system_version' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['system_version'] : 'n/a',
'app_version' => $this->settings['app_info']['app_version'], 'app_version' => $this->settings['app_info']['app_version'],
'system_lang_code' => $this->settings['app_info']['lang_code'], 'system_lang_code' => $this->settings['app_info']['lang_code'],
'lang_code' => $this->settings['app_info']['lang_code'], 'lang_code' => $this->settings['app_info']['lang_code'],
'lang_pack' => '', 'lang_pack' => '',
'query' => $this->serialize_method($method, $arguments), 'query' => $this->serialize_method($method, $arguments),
] ]
), ),
], ],

View File

@ -73,8 +73,8 @@ $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sem
echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote
'.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL; '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y') !== false) { if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y') !== false) {
$start = false; $start = false;
var_dump($id = $MadelineProto->request_call('@danogentili', [ var_dump($id = $MadelineProto->request_call('@danogentili', [
'set_state' => function ($state) { 'set_state' => function ($state) {
var_dump("SET STATE $state"); var_dump("SET STATE $state");
}, },
@ -106,31 +106,32 @@ var_dump($id = $MadelineProto->request_call('@danogentili', [
], ],
])); ]));
while (!$start) $MadelineProto->get_updates(); while (!$start) {
$controller = $MadelineProto->get_call($id)['controller']; $MadelineProto->get_updates();
$samplerate = 48000; }
$period = 1 / $samplerate; $controller = $MadelineProto->get_call($id)['controller'];
$writePeriod = $period * 960; $samplerate = 48000;
var_dump($writePeriod); $period = 1 / $samplerate;
var_dump('SENDING DATA'); $writePeriod = $period * 960;
$f = fopen('output.raw', 'r'); var_dump($writePeriod);
$time = microtime(true); var_dump('SENDING DATA');
while (!feof($f)) { $f = fopen('output.raw', 'r');
var_dump($t = (int) (($writePeriod - $time = microtime(true);
while (!feof($f)) {
var_dump($t = (int) (($writePeriod -
(microtime(true) - $time) // Time it took me to write frames (microtime(true) - $time) // Time it took me to write frames
) * 1000000)); ) * 1000000));
usleep( usleep(
$t $t
); );
$time = microtime(true); $time = microtime(true);
var_dump($controller->writeFrames(stream_get_contents($f, 960 * 2))); var_dump($controller->writeFrames(stream_get_contents($f, 960 * 2)));
var_dump('sent 960 frames'); var_dump('sent 960 frames');
} }
while ($MadelineProto->call_status($id) !== \danog\MadelineProto\MTProto::READY) {
while ($MadelineProto->call_status($id) !== \danog\MadelineProto\MTProto::READY) { $MadelineProto->get_updates();
$MadelineProto->get_updates(); }
}
var_dump(getenv('TEST_SECRET_CHAT')); var_dump(getenv('TEST_SECRET_CHAT'));
$secret = $MadelineProto->API->request_secret_chat(getenv('TEST_SECRET_CHAT')); $secret = $MadelineProto->API->request_secret_chat(getenv('TEST_SECRET_CHAT'));
@ -199,7 +200,6 @@ $mention = $MadelineProto->get_info(getenv('TEST_USERNAME')); // Returns an arra
$mention = $mention['user_id']; // Selects only the numeric user id $mention = $mention['user_id']; // Selects only the numeric user id
$media = []; $media = [];
// Sticker // Sticker
$inputFile = $MadelineProto->upload('tests/lel.webp'); $inputFile = $MadelineProto->upload('tests/lel.webp');
$media['sticker'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]]; $media['sticker'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/lel.webp'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeSticker', 'alt' => 'LEL', 'stickerset' => ['_' => 'inputStickerSetEmpty']]]];