Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
III-658: Use String as StringLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
bramcordie committed Mar 15, 2016
1 parent a42f949 commit 5079619
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/HasActorIdTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trait HasActorIdTrait
{

/**
* @var String
* @var StringLiteral
*/
private $actorId;

Expand All @@ -24,7 +24,7 @@ private function setActorId(StringLiteral $actorId)
}

/**
* @return String
* @return StringLiteral
*/
public function getActorId()
{
Expand Down
2 changes: 1 addition & 1 deletion src/HasAuthoringMetadataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait HasAuthoringMetadataTrait
protected $time;

/**
* @var String
* @var StringLiteral
*/
protected $author;

Expand Down
2 changes: 1 addition & 1 deletion src/HasEventIdTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
trait HasEventIdTrait
{
/**
* @var String
* @var StringLiteral
*/
protected $eventId;

Expand Down
21 changes: 9 additions & 12 deletions test/ActorCreatedJSONDeserializerTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php
/**
* @file
*/

namespace CultuurNet\UDB2DomainEvents;

use CultuurNet\Deserializer\MissingValueException;
use DateTime;
use ValueObjects\String\String;
use ValueObjects\String\String as StringLiteral;
use ValueObjects\Web\Url;

class ActorCreatedJSONDeserializerTest extends \PHPUnit_Framework_TestCase
Expand All @@ -30,7 +27,7 @@ public function testRequiresActorId()
);

$this->deserializer->deserialize(
new String('{}')
new StringLiteral('{}')
);
}

Expand All @@ -42,7 +39,7 @@ public function testRequiresTime()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"url": "http://foo.bar/event/foo"
Expand All @@ -59,7 +56,7 @@ public function testTimeNeedsToBeISO8601Formatted()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"author": "me@example.com",
Expand All @@ -78,7 +75,7 @@ public function testRequiresAuthor()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -96,7 +93,7 @@ public function testRequiresUrl()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"author": "me@example.com",
Expand All @@ -109,7 +106,7 @@ public function testRequiresUrl()
public function testReturnsActorCreated()
{
$actorCreated = $this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -125,12 +122,12 @@ public function testReturnsActorCreated()
);

$this->assertEquals(
new String('foo'),
new StringLiteral('foo'),
$actorCreated->getActorId()
);

$this->assertEquals(
new String('me@example.com'),
new StringLiteral('me@example.com'),
$actorCreated->getAuthor()
);

Expand Down
14 changes: 7 additions & 7 deletions test/ActorCreatedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace CultuurNet\UDB2DomainEvents;

use ValueObjects\String\String;
use ValueObjects\String\String as StringLiteral;
use ValueObjects\Web\Url;

class ActorCreatedTest extends \PHPUnit_Framework_TestCase
Expand All @@ -18,9 +18,9 @@ public function testActorIdCanNotBeEmptyString()
);

new ActorCreated(
new String(''),
new StringLiteral(''),
new \DateTimeImmutable(),
new String(''),
new StringLiteral(''),
Url::fromNative('http://foo.bar/event/foo')
);
}
Expand All @@ -32,9 +32,9 @@ private function createActorCreated(\DateTimeImmutable $time = null)
}

return new ActorCreated(
new String('123'),
new StringLiteral('123'),
$time,
new String('me@example.com'),
new StringLiteral('me@example.com'),
Url::fromNative('http://foo.bar/event/foo')
);
}
Expand All @@ -44,7 +44,7 @@ public function testGetActorId()
$eventCreated = $this->createActorCreated();

$this->assertEquals(
new String('123'),
new StringLiteral('123'),
$eventCreated->getActorId()
);
}
Expand All @@ -54,7 +54,7 @@ public function testGetAuthor()
$eventCreated = $this->createActorCreated();

$this->assertEquals(
new String('me@example.com'),
new StringLiteral('me@example.com'),
$eventCreated->getAuthor()
);
}
Expand Down
21 changes: 9 additions & 12 deletions test/ActorUpdatedJSONDeserializerTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php
/**
* @file
*/

namespace CultuurNet\UDB2DomainEvents;

use CultuurNet\Deserializer\MissingValueException;
use DateTime;
use ValueObjects\String\String;
use ValueObjects\String\String as StringLiteral;
use ValueObjects\Web\Url;

class ActorUpdatedJSONDeserializerTest extends \PHPUnit_Framework_TestCase
Expand All @@ -30,7 +27,7 @@ public function testRequiresActorId()
);

$this->deserializer->deserialize(
new String('{}')
new StringLiteral('{}')
);
}

Expand All @@ -42,7 +39,7 @@ public function testRequiresTime()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"url": "http://foo.bar/event/foo"
Expand All @@ -59,7 +56,7 @@ public function testTimeNeedsToBeISO8601Formatted()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"author": "me@example.com",
Expand All @@ -78,7 +75,7 @@ public function testRequiresAuthor()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -96,7 +93,7 @@ public function testRequiresUrl()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"author": "me@example.com",
Expand All @@ -109,7 +106,7 @@ public function testRequiresUrl()
public function testReturnsActorUpdated()
{
$actorUpdated = $this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"actorId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -125,12 +122,12 @@ public function testReturnsActorUpdated()
);

$this->assertEquals(
new String('foo'),
new StringLiteral('foo'),
$actorUpdated->getactorId()
);

$this->assertEquals(
new String('me@example.com'),
new StringLiteral('me@example.com'),
$actorUpdated->getAuthor()
);

Expand Down
14 changes: 7 additions & 7 deletions test/ActorUpdatedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace CultuurNet\UDB2DomainEvents;

use ValueObjects\String\String;
use ValueObjects\String\String as StringLiteral;
use ValueObjects\Web\Url;

class ActorUpdatedTest extends \PHPUnit_Framework_TestCase
Expand All @@ -18,9 +18,9 @@ public function testActorIdCanNotBeEmptyString()
);

new ActorUpdated(
new String(''),
new StringLiteral(''),
new \DateTimeImmutable(),
new String(''),
new StringLiteral(''),
Url::fromNative('http://foo.bar/event/foo')
);
}
Expand All @@ -32,9 +32,9 @@ private function createActorUpdated(\DateTimeImmutable $time = null)
}

return new ActorUpdated(
new String('123'),
new StringLiteral('123'),
$time,
new String('me@example.com'),
new StringLiteral('me@example.com'),
Url::fromNative('http://foo.bar/event/foo')
);
}
Expand All @@ -44,7 +44,7 @@ public function testGetActorId()
$actorUpdated = $this->createActorUpdated();

$this->assertEquals(
new String('123'),
new StringLiteral('123'),
$actorUpdated->getActorId()
);
}
Expand All @@ -54,7 +54,7 @@ public function testGetAuthor()
$actorUpdated = $this->createActorUpdated();

$this->assertEquals(
new String('me@example.com'),
new StringLiteral('me@example.com'),
$actorUpdated->getAuthor()
);
}
Expand Down
18 changes: 9 additions & 9 deletions test/EventCreatedJSONDeserializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use CultuurNet\Deserializer\MissingValueException;
use DateTime;
use ValueObjects\String\String;
use ValueObjects\String\String as StringLiteral;
use ValueObjects\Web\Url;

class EventCreatedJSONDeserializerTest extends \PHPUnit_Framework_TestCase
Expand All @@ -30,7 +30,7 @@ public function testRequiresEventId()
);

$this->deserializer->deserialize(
new String('{}')
new StringLiteral('{}')
);
}

Expand All @@ -42,7 +42,7 @@ public function testRequiresTime()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"eventId": "foo",
"url": "http://foo.bar/event/foo"
Expand All @@ -59,7 +59,7 @@ public function testTimeNeedsToBeISO8601Formatted()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"eventId": "foo",
"author": "me@example.com",
Expand All @@ -78,7 +78,7 @@ public function testRequiresAuthor()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"eventId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -96,7 +96,7 @@ public function testRequiresUrl()
);

$this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"eventId": "foo",
"author": "me@example.com",
Expand All @@ -109,7 +109,7 @@ public function testRequiresUrl()
public function testReturnsEventCreated()
{
$eventCreated = $this->deserializer->deserialize(
new String(
new StringLiteral(
'{
"eventId": "foo",
"time": "2015-02-20T20:39:09+0100",
Expand All @@ -125,12 +125,12 @@ public function testReturnsEventCreated()
);

$this->assertEquals(
new String('foo'),
new StringLiteral('foo'),
$eventCreated->getEventId()
);

$this->assertEquals(
new String('me@example.com'),
new StringLiteral('me@example.com'),
$eventCreated->getAuthor()
);

Expand Down

0 comments on commit 5079619

Please sign in to comment.