1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 09:54:17 +02:00
This commit is contained in:
Robin Appelman 2019-04-12 13:37:41 +02:00
commit 5986d8552d
5 changed files with 8 additions and 11 deletions

View file

@ -25,7 +25,6 @@ class UserController extends BaseController {
try { try {
$steamId = Parser::convertSteamIdToCommunityId($steamId); $steamId = Parser::convertSteamIdToCommunityId($steamId);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
} }
} }
\Flight::json($this->userProvider->get($steamId)); \Flight::json($this->userProvider->get($steamId));

View file

@ -5,9 +5,7 @@ declare(strict_types=1);
namespace Demostf\API\Demo; namespace Demostf\API\Demo;
use Demostf\API\Controllers\TempController; use Demostf\API\Controllers\TempController;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use function GuzzleHttp\Psr7\stream_for;
/** /**
* Wrapper around demo.js parser. * Wrapper around demo.js parser.
@ -27,7 +25,7 @@ class RawParser {
public function parse(string $path): ?array { public function parse(string $path): ?array {
try { try {
$command = $this->parserPath . " " . escapeshellarg($path); $command = $this->parserPath . ' ' . escapeshellarg($path);
$output = shell_exec($command); $output = shell_exec($command);
$result = \GuzzleHttp\json_decode($output, true); $result = \GuzzleHttp\json_decode($output, true);
if (null === $result) { if (null === $result) {

View file

@ -11,7 +11,7 @@ use Demostf\API\Demo\DemoStore;
use Demostf\API\Providers\ChatProvider; use Demostf\API\Providers\ChatProvider;
use Demostf\API\Providers\DemoListProvider; use Demostf\API\Providers\DemoListProvider;
use Demostf\API\Providers\DemoProvider; use Demostf\API\Providers\DemoProvider;
use \InvalidArgumentException; use InvalidArgumentException;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
class DemoControllerTest extends ControllerTest { class DemoControllerTest extends ControllerTest {
@ -91,7 +91,7 @@ class DemoControllerTest extends ControllerTest {
]); ]);
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Invalid key"); $this->expectExceptionMessage('Invalid key');
$controller->setDemoUrl('1'); $controller->setDemoUrl('1');
} }
@ -106,7 +106,7 @@ class DemoControllerTest extends ControllerTest {
]); ]);
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Invalid demo hash"); $this->expectExceptionMessage('Invalid demo hash');
$demo = $this->createConfiguredMock(Demo::class, [ $demo = $this->createConfiguredMock(Demo::class, [
'getHash' => 'validhash', 'getHash' => 'validhash',

View file

@ -43,7 +43,7 @@ class HeaderParserTest extends TestCase {
public function testNonDemoShort() { public function testNonDemoShort() {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Not an HL2 demo"); $this->expectExceptionMessage('Not an HL2 demo');
$parser = new HeaderParser(); $parser = new HeaderParser();
$parser->parseString('short'); $parser->parseString('short');
@ -51,7 +51,7 @@ class HeaderParserTest extends TestCase {
public function testNonDemoLong() { public function testNonDemoLong() {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Not an HL2 demo"); $this->expectExceptionMessage('Not an HL2 demo');
$parser = new HeaderParser(); $parser = new HeaderParser();
$parser->parseHeader(__FILE__); $parser->parseHeader(__FILE__);

View file

@ -215,7 +215,7 @@ class UploadProviderTest extends TestCase {
public function testUploadNonDemo() { public function testUploadNonDemo() {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Not an HL2 demo"); $this->expectExceptionMessage('Not an HL2 demo');
file_put_contents($this->tmpDir . '/foo.dem', 'asd'); file_put_contents($this->tmpDir . '/foo.dem', 'asd');
@ -312,7 +312,7 @@ class UploadProviderTest extends TestCase {
public function testUploadKey() { public function testUploadKey() {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Not an HL2 demo"); $this->expectExceptionMessage('Not an HL2 demo');
$uploadProvider = new UploadProvider( $uploadProvider = new UploadProvider(
$this->getDatabaseConnection(), $this->getDatabaseConnection(),