Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //
- // Oussama Elgoumri
- // ktsnepyg9igfz1@gmail.com
- //
- // Wed Jan 11 13:05:57 WET 2017
- //
- namespace App\Api;
- use PHPUnit\Framework\TestCase;
- class XTreamTest extends TestCase
- {
- public function setUp()
- {
- $this->faker = \Faker\Factory::create();
- }
- /**
- * @test
- */
- public function createNewLine()
- {
- $f = $this->faker;
- $username = str_random(10);
- $password = str_random(10);
- $max_connections = mt_rand(1, 10);
- $is_restreamer = $f->boolean;
- $exp_date = strtotime('+' . mt_rand(1, 12) . ' month');
- $bouquet = json_encode([ 1, 2, 3 ]);
- $data = [
- 'username' => $username,
- 'password' => $password,
- 'max_connections' => $max_connections,
- 'is_restreamer' => $is_restreamer,
- 'exp_date' => $exp_date,
- 'bouquet' => $bouquet,
- ];
- $results = XTream__createNewLine($data);
- $this->assertTrue($results['result']);
- $this->assertEquals($results['username'], $username);
- $this->assertEquals($results['password'], $password);
- $info = $this->viewLineInfo($results['username'], $results['password']);
- $this->assertTrue($info['result']);
- $this->assertEquals($info['user_info']['username'], $username);
- $this->assertEquals($info['user_info']['password'], $password);
- $this->assertEquals($info['user_info']['exp_date'], $exp_date);
- $this->assertEquals(json_encode($info['user_info']['bouquet']), $bouquet);
- $this->assertEquals($info['user_info']['max_connections'], $max_connections);
- $this->assertEquals((bool) $info['user_info']['is_restreamer'], (bool) $is_restreamer);
- }
- /**
- * @test
- */
- public function editLine()
- {
- $data = XTream__createNewLine([]);
- $results = XTream__editLine(
- $data['username'],
- $data['password'],
- [
- 'password' => 'pass',
- ]
- );
- $this->assertTrue($results['result']);
- }
- private function viewLineInfo($username, $password)
- {
- return XTream__viewLineInfo($username, $password);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement