mirror of
https://github.com/elyby/mojang-api.git
synced 2025-05-31 14:11:44 +05:30
Init
This commit is contained in:
36
tests/Response/Properties/FactoryTest.php
Normal file
36
tests/Response/Properties/FactoryTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Ely\Mojang\Test\Response\Properties;
|
||||
|
||||
use Ely\Mojang\Response\Properties\Factory;
|
||||
use Ely\Mojang\Response\Properties\Property;
|
||||
use Ely\Mojang\Response\Properties\TexturesProperty;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class FactoryTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @param array $inputProps
|
||||
* @param string $expectedType
|
||||
*
|
||||
* @dataProvider getProps
|
||||
*/
|
||||
public function testCreate(array $inputProps, string $expectedType) {
|
||||
$this->assertInstanceOf($expectedType, Factory::createFromProp($inputProps));
|
||||
}
|
||||
|
||||
public function getProps(): iterable {
|
||||
yield [[
|
||||
'name' => 'textures',
|
||||
'value' => 'value',
|
||||
'signature' => '123',
|
||||
], TexturesProperty::class];
|
||||
|
||||
yield [[
|
||||
'name' => 'other',
|
||||
'value' => 'value',
|
||||
], Property::class];
|
||||
}
|
||||
|
||||
}
|
50
tests/Response/Properties/TexturesPropertyValueTest.php
Normal file
50
tests/Response/Properties/TexturesPropertyValueTest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Ely\Mojang\Test\Response\Properties;
|
||||
|
||||
use Ely\Mojang\Response\Properties\TexturesPropertyValue;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TexturesPropertyValueTest extends TestCase {
|
||||
|
||||
public function testGetSkin() {
|
||||
$object = new TexturesPropertyValue('', '', [
|
||||
'SKIN' => [
|
||||
'url' => 'skin url',
|
||||
],
|
||||
], 0);
|
||||
$this->assertNotNull($object->getSkin());
|
||||
$this->assertSame('skin url', $object->getSkin()->getUrl());
|
||||
$this->assertFalse($object->getSkin()->isSlim());
|
||||
|
||||
$object = new TexturesPropertyValue('', '', [
|
||||
'SKIN' => [
|
||||
'url' => 'skin url',
|
||||
'metainfo' => [
|
||||
'model' => 'slim',
|
||||
],
|
||||
],
|
||||
], 0);
|
||||
$this->assertNotNull($object->getSkin());
|
||||
$this->assertSame('skin url', $object->getSkin()->getUrl());
|
||||
$this->assertTrue($object->getSkin()->isSlim());
|
||||
|
||||
$object = new TexturesPropertyValue('', '', [], 0);
|
||||
$this->assertNull($object->getSkin());
|
||||
}
|
||||
|
||||
public function testGetCape() {
|
||||
$object = new TexturesPropertyValue('', '', [
|
||||
'CAPE' => [
|
||||
'url' => 'cape url',
|
||||
],
|
||||
], 0);
|
||||
$this->assertNotNull($object->getCape());
|
||||
$this->assertSame('cape url', $object->getCape()->getUrl());
|
||||
|
||||
$object = new TexturesPropertyValue('', '', [], 0);
|
||||
$this->assertNull($object->getCape());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user