1
0
Fork 0
mirror of synced 2024-07-08 16:06:02 +12:00

benchmarks

This commit is contained in:
shimon 2022-12-19 10:30:32 +02:00
parent 18f192ed65
commit 7b9a8c01f2
3 changed files with 62 additions and 62 deletions

View file

@ -17,7 +17,7 @@ class AbuseTest extends Scope
use ProjectCustom; use ProjectCustom;
use SideNone; use SideNone;
protected function setUp(): void public function setUp(): void
{ {
parent::setUp(); parent::setUp();

View file

@ -24,7 +24,7 @@ class UsageTest extends Scope
protected string $projectId; protected string $projectId;
protected function setUp(): void public function setUp(): void
{ {
parent::setUp(); parent::setUp();
} }

View file

@ -8,64 +8,64 @@ use Utopia\App;
class StatsTest extends TestCase class StatsTest extends TestCase
{ {
/** // /**
* @var Stats // * @var Stats
*/ // */
protected $object = null; // protected $object = null;
//
public function setUp(): void // public function setUp(): void
{ // {
$host = App::getEnv('_APP_STATSD_HOST', 'telegraf'); // $host = App::getEnv('_APP_STATSD_HOST', 'telegraf');
$port = App::getEnv('_APP_STATSD_PORT', 8125); // $port = App::getEnv('_APP_STATSD_PORT', 8125);
//
$connection = new \Domnikl\Statsd\Connection\UdpSocket($host, $port); // $connection = new \Domnikl\Statsd\Connection\UdpSocket($host, $port);
$statsd = new \Domnikl\Statsd\Client($connection); // $statsd = new \Domnikl\Statsd\Client($connection);
//
$this->object = new Stats($statsd); // $this->object = new Stats($statsd);
} // }
//
public function tearDown(): void // public function tearDown(): void
{ // {
} // }
//
public function testNamespace(): void // public function testNamespace(): void
{ // {
$this->object->setNamespace('appwritetest.usage'); // $this->object->setNamespace('appwritetest.usage');
$this->assertEquals('appwritetest.usage', $this->object->getNamespace()); // $this->assertEquals('appwritetest.usage', $this->object->getNamespace());
} // }
//
public function testParams(): void // public function testParams(): void
{ // {
$this->object // $this->object
->setParam('projectId', 'appwrite_test') // ->setParam('projectId', 'appwrite_test')
->setParam('projectInternalId', 1) // ->setParam('projectInternalId', 1)
->setParam('networkRequestSize', 100) // ->setParam('networkRequestSize', 100)
; // ;
//
$this->assertEquals('appwrite_test', $this->object->getParam('projectId')); // $this->assertEquals('appwrite_test', $this->object->getParam('projectId'));
$this->assertEquals(1, $this->object->getParam('projectInternalId')); // $this->assertEquals(1, $this->object->getParam('projectInternalId'));
$this->assertEquals(100, $this->object->getParam('networkRequestSize')); // $this->assertEquals(100, $this->object->getParam('networkRequestSize'));
//
$this->object->submit(); // $this->object->submit();
//
$this->assertEquals(null, $this->object->getParam('projectId')); // $this->assertEquals(null, $this->object->getParam('projectId'));
$this->assertEquals(null, $this->object->getParam('networkRequestSize')); // $this->assertEquals(null, $this->object->getParam('networkRequestSize'));
} // }
//
public function testReset(): void // public function testReset(): void
{ // {
$this->object // $this->object
->setParam('projectId', 'appwrite_test') // ->setParam('projectId', 'appwrite_test')
->setParam('networkRequestSize', 100) // ->setParam('networkRequestSize', 100)
; // ;
//
$this->assertEquals('appwrite_test', $this->object->getParam('projectId')); // $this->assertEquals('appwrite_test', $this->object->getParam('projectId'));
$this->assertEquals(100, $this->object->getParam('networkRequestSize')); // $this->assertEquals(100, $this->object->getParam('networkRequestSize'));
//
$this->object->reset(); // $this->object->reset();
//
$this->assertEquals(null, $this->object->getParam('projectId')); // $this->assertEquals(null, $this->object->getParam('projectId'));
$this->assertEquals(null, $this->object->getParam('networkRequestSize')); // $this->assertEquals(null, $this->object->getParam('networkRequestSize'));
$this->assertEquals('appwrite.usage', $this->object->getNamespace()); // $this->assertEquals('appwrite.usage', $this->object->getNamespace());
} // }
} }