-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/Unit/Configuration/Classmap/ClassMapCollectionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace SoapTest\ExtSoapEngine\Unit\Configuration\Classmap; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Soap\ExtSoapEngine\Configuration\ClassMap\ClassMap; | ||
use Soap\ExtSoapEngine\Configuration\ClassMap\ClassMapCollection; | ||
|
||
class ClassMapCollectionTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_tests_class_maps(): void | ||
{ | ||
$classMap = new ClassMapCollection( | ||
$item1 = new ClassMap('wsdlType', 'phpType'), | ||
new ClassMap('double', 'double'), | ||
$item2 = new ClassMap('double', 'double'), | ||
); | ||
|
||
self::assertCount(2, $classMap); | ||
self::assertSame([ | ||
'wsdlType' => $item1, | ||
'double' => $item2, | ||
], iterator_to_array($classMap)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace SoapTest\ExtSoapEngine\Unit\Configuration\Classmap; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Soap\ExtSoapEngine\Configuration\ClassMap\ClassMap; | ||
|
||
class ClassMapTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_tests_class_maps(): void | ||
{ | ||
$classMap = new ClassMap('wsdlType', 'phpType'); | ||
|
||
self::assertSame('wsdlType', $classMap->getWsdlType()); | ||
self::assertSame('phpType', $classMap->getPhpClassName()); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
tests/Unit/Configuration/TypeConverter/DecimalTypeConverterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace SoapTest\ExtSoapEngine\Unit\Configuration\TypeConverter; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Soap\ExtSoapEngine\Configuration\TypeConverter\DecimalTypeConverter; | ||
|
||
class DecimalTypeConverterTest extends TestCase | ||
{ | ||
protected DecimalTypeConverter $converter; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->converter = new DecimalTypeConverter(); | ||
} | ||
|
||
public function testNamespaceIsSpecificValue() | ||
{ | ||
$this->assertSame('http://www.w3.org/2001/XMLSchema', $this->converter->getTypeNamespace()); | ||
} | ||
|
||
public function testNameIsSpecificValue() | ||
{ | ||
$this->assertSame('decimal', $this->converter->getTypeName()); | ||
} | ||
|
||
public function testConvertXmlToPhp() | ||
{ | ||
$xml = '<decimal>24.700</decimal>'; | ||
|
||
$php = $this->converter->convertXmlToPhp($xml); | ||
|
||
$this->assertIsFloat($php); | ||
} | ||
|
||
public function testConvertXmlToPhpWhenNoTextContent() | ||
{ | ||
$xml = '<decimal/>'; | ||
|
||
$php = $this->converter->convertXmlToPhp($xml); | ||
|
||
$this->assertNull($php); | ||
} | ||
|
||
public function testConvertPhpToXml() | ||
{ | ||
$xml = '<decimal>24.7</decimal>'; | ||
|
||
$output = $this->converter->convertPhpToXml((float) 24.700); | ||
|
||
$this->assertSame($xml, $output); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
tests/Unit/Configuration/TypeConverter/DoubleTypeConverterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace SoapTest\ExtSoapEngine\Unit\Configuration\TypeConverter; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Soap\ExtSoapEngine\Configuration\TypeConverter\DoubleTypeConverter; | ||
|
||
class DoubleTypeConverterTest extends TestCase | ||
{ | ||
protected DoubleTypeConverter $converter; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->converter = new DoubleTypeConverter(); | ||
} | ||
|
||
public function testNamespaceIsSpecificValue() | ||
{ | ||
$this->assertSame('http://www.w3.org/2001/XMLSchema', $this->converter->getTypeNamespace()); | ||
} | ||
|
||
public function testNameIsSpecificValue() | ||
{ | ||
$this->assertSame('double', $this->converter->getTypeName()); | ||
} | ||
|
||
public function testConvertXmlToPhp() | ||
{ | ||
$xml = '<double>24.700</double>'; | ||
|
||
$php = $this->converter->convertXmlToPhp($xml); | ||
|
||
$this->assertIsFloat($php); | ||
} | ||
|
||
public function testConvertXmlToPhpWhenNoTextContent() | ||
{ | ||
$xml = '<double/>'; | ||
|
||
$php = $this->converter->convertXmlToPhp($xml); | ||
|
||
$this->assertNull($php); | ||
} | ||
|
||
public function testConvertPhpToXml() | ||
{ | ||
$xml = '<double>24.7</double>'; | ||
|
||
$output = $this->converter->convertPhpToXml((float) 24.700); | ||
|
||
$this->assertSame($xml, $output); | ||
} | ||
} |