Skip to content

Commit

Permalink
renamed namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
alextartan committed Sep 28, 2018
1 parent f64c9f5 commit 092570a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 33 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"autoload": {
"psr-4": {
"RedLine\\Array2Xml\\": "src/ArrayToXml"
"AlexTartan\\Array2Xml\\": "src/ArrayToXml"
}
},
"require-dev": {
Expand All @@ -33,7 +33,7 @@
},
"autoload-dev": {
"psr-4": {
"RedLineTest\\Array2Xml\\": "test/ArrayToXml"
"AlexTartanTest\\Array2Xml\\": "test/ArrayToXml"
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/ArrayToXml/ArrayToXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* limitations under the License.
**/

namespace RedLine\Array2Xml;
namespace AlexTartan\Array2Xml;

use DOMDocument;
use DOMElement;
use DOMNode;
use RedLine\Array2Xml\Exception\ConversionException;
use AlexTartan\Array2Xml\Exception\ConversionException;

/**
* This class converts an array into an XML file
Expand Down
2 changes: 1 addition & 1 deletion src/ArrayToXml/Exception/ConversionException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace RedLine\Array2Xml\Exception;
namespace AlexTartan\Array2Xml\Exception;

class ConversionException extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/ArrayToXml/XmlToArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* limitations under the License.
**/

namespace RedLine\Array2Xml;
namespace AlexTartan\Array2Xml;

use DOMDocument;
use DOMNode;
use RedLine\Array2Xml\Exception\ConversionException;
use AlexTartan\Array2Xml\Exception\ConversionException;

/**
* This class helps convert an XML to an array
Expand Down
28 changes: 13 additions & 15 deletions test/ArrayToXml/ArrayToXmlTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php
declare(strict_types=1);

namespace RedLineTest\Array2Xml;
namespace AlexTartanTest\Array2Xml;

use AlexTartan\Array2Xml\ArrayToXml;
use AlexTartan\Array2Xml\Exception\ConversionException;
use AlexTartan\Array2Xml\XmlToArray;
use PHPUnit\Framework\TestCase;
use RedLine\Array2Xml\ArrayToXml;
use RedLine\Array2Xml\XmlToArray;

class ArrayToXmlTest extends TestCase
{
Expand Down Expand Up @@ -35,12 +36,11 @@ public function testSimpleConversionFromString()
);
}

/**
* @expectedException \RedLine\Array2Xml\Exception\ConversionException
* @expectedExceptionMessage Xml needs to have one root element
*/
public function testSimpleConversionFromStringFailsOnMultipleRootNodes()
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage('Xml needs to have one root element');

(new ArrayToXml())->buildXml(
[
'note' => [
Expand Down Expand Up @@ -199,12 +199,11 @@ public function testWithValue()
);
}

/**
* @expectedException \RedLine\Array2Xml\Exception\ConversionException
* @expectedExceptionMessage Illegal character in tag name. tag: !WOW in node: note
*/
public function testInvalidNodeName()
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage('Illegal character in tag name. tag: !WOW in node: note');

(new ArrayToXml)->buildXml(
[
'messages' => [
Expand All @@ -218,12 +217,11 @@ public function testInvalidNodeName()
);
}

/**
* @expectedException \RedLine\Array2Xml\Exception\ConversionException
* @expectedExceptionMessage Illegal character in attribute name. attribute: !id in node: note
*/
public function testInvalidNodeNameInAttributes()
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage('Illegal character in attribute name. attribute: !id in node: note');

(new ArrayToXml)->buildXml(
[
'messages' => [
Expand Down
4 changes: 2 additions & 2 deletions test/ArrayToXml/Exception/ConversionExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
declare(strict_types=1);

namespace RedLineTest\Array2Xml\Exception;
namespace AlexTartanTest\Array2Xml\Exception;

use PHPUnit\Framework\TestCase;
use RedLine\Array2Xml\Exception\ConversionException;
use AlexTartan\Array2Xml\Exception\ConversionException;

class ConversionExceptionTest extends TestCase
{
Expand Down
18 changes: 9 additions & 9 deletions test/ArrayToXml/XmlToArrayTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
declare(strict_types=1);

namespace RedLineTest\Array2Xml;
namespace AlexTartanTest\Array2Xml;

use AlexTartan\Array2Xml\Exception\ConversionException;
use AlexTartan\Array2Xml\XmlToArray;
use PHPUnit\Framework\TestCase;
use RedLine\Array2Xml\XmlToArray;

class XmlToArrayTest extends TestCase
{
Expand Down Expand Up @@ -68,12 +69,11 @@ public function testBuildFromStringWithMultipleNodes()
);
}

/**
* @expectedException \RedLine\Array2Xml\Exception\ConversionException
* @expectedExceptionMessage E_WARNING Start tag expected, '<' not found in Entity, line: 1
*/
public function testBuildFromStringThrowsExceptionOnInvalidXml()
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage("E_WARNING Start tag expected, '<' not found in Entity, line: 1");

$output = (new XmlToArray())->buildArrayFromString(
'no_xml'
);
Expand Down Expand Up @@ -304,9 +304,9 @@ public function testXmlWithEmptyNodes()
static::assertSame(
[
'table' => [
'name' => '',
'width' => '80',
'length' => '120',
'name' => '',
'width' => '80',
'length' => '120',
],
],
$output
Expand Down

0 comments on commit 092570a

Please sign in to comment.