Skip to content

Commit 17de261

Browse files
committed
use class constants instead of string literals
1 parent 105acf6 commit 17de261

18 files changed

+45
-34
lines changed

spec/ActivityProfileDocumentSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PhpSpec\ObjectBehavior;
1515
use Xabbuh\XApi\Model\Activity;
1616
use Xabbuh\XApi\Model\ActivityProfile;
17+
use Xabbuh\XApi\Model\Document;
1718
use Xabbuh\XApi\Model\DocumentData;
1819
use Xabbuh\XApi\Model\IRI;
1920

@@ -29,7 +30,7 @@ function let()
2930

3031
function it_is_a_document()
3132
{
32-
$this->shouldHaveType('Xabbuh\XApi\Model\Document');
33+
$this->shouldHaveType(Document::class);
3334
}
3435

3536
function its_data_can_be_read()

spec/ActivitySpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
use PhpSpec\ObjectBehavior;
1515
use Xabbuh\XApi\Model\Activity;
1616
use Xabbuh\XApi\Model\IRI;
17+
use Xabbuh\XApi\Model\StatementObject;
1718

1819
class ActivitySpec extends ObjectBehavior
1920
{
2021
function it_is_an_xapi_object()
2122
{
2223
$this->beConstructedWith(IRI::fromString('http://tincanapi.com/conformancetest/activityid'));
23-
$this->shouldHaveType('Xabbuh\XApi\Model\StatementObject');
24+
$this->shouldHaveType(StatementObject::class);
2425
}
2526

2627
function it_is_equal_with_other_activity_if_ids_are_equal_and_definitions_are_missing()

spec/AgentProfileDocumentSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PhpSpec\ObjectBehavior;
1515
use Xabbuh\XApi\Model\Agent;
1616
use Xabbuh\XApi\Model\AgentProfile;
17+
use Xabbuh\XApi\Model\Document;
1718
use Xabbuh\XApi\Model\DocumentData;
1819
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
1920
use Xabbuh\XApi\Model\IRI;
@@ -30,7 +31,7 @@ function let()
3031

3132
function it_is_a_document()
3233
{
33-
$this->shouldHaveType('Xabbuh\XApi\Model\Document');
34+
$this->shouldHaveType(Document::class);
3435
}
3536

3637
function its_data_can_be_read()

spec/AgentSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PhpSpec\ObjectBehavior;
1515
use Xabbuh\XApi\Model\Activity;
16+
use Xabbuh\XApi\Model\Actor;
1617
use Xabbuh\XApi\Model\Group;
1718
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
1819
use Xabbuh\XApi\Model\IRI;
@@ -23,7 +24,7 @@ function it_is_an_actor()
2324
{
2425
$iri = InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:[email protected]'));
2526
$this->beConstructedWith($iri);
26-
$this->shouldHaveType('Xabbuh\XApi\Model\Actor');
27+
$this->shouldHaveType(Actor::class);
2728
}
2829

2930
function its_properties_can_be_read()

spec/GroupSpec.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
namespace spec\Xabbuh\XApi\Model;
1313

1414
use PhpSpec\ObjectBehavior;
15+
use Xabbuh\XApi\Model\Actor;
1516
use Xabbuh\XApi\Model\Agent;
17+
use Xabbuh\XApi\Model\Group;
1618
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
1719
use Xabbuh\XApi\Model\IRI;
1820

@@ -21,13 +23,13 @@ class GroupSpec extends ObjectBehavior
2123
function it_can_be_initialized_without_an_inverse_functional_identifier()
2224
{
2325
$this->beConstructedWith(null, 'anonymous group');
24-
$this->shouldBeAnInstanceOf('Xabbuh\XApi\Model\Group');
26+
$this->shouldBeAnInstanceOf(Group::class);
2527
}
2628

2729
function it_is_an_actor()
2830
{
2931
$this->beConstructedWith(null, 'test');
30-
$this->shouldHaveType('Xabbuh\XApi\Model\Actor');
32+
$this->shouldHaveType(Actor::class);
3133
}
3234

3335
function its_properties_can_be_read()

spec/Interaction/InteractionDefinitionSpec.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313

1414
use spec\Xabbuh\XApi\Model\DefinitionSpec;
1515
use Xabbuh\XApi\Model\Definition;
16+
use Xabbuh\XApi\Model\Interaction\InteractionDefinition;
1617

1718
abstract class InteractionDefinitionSpec extends DefinitionSpec
1819
{
1920
function it_is_a_definition()
2021
{
21-
$this->shouldHaveType('Xabbuh\XApi\Model\Definition');
22+
$this->shouldHaveType(Definition::class);
2223
}
2324

2425
function it_is_an_interaction()
2526
{
26-
$this->shouldHaveType('Xabbuh\XApi\Model\Interaction\InteractionDefinition');
27+
$this->shouldHaveType(InteractionDefinition::class);
2728
}
2829

2930
function it_is_not_equal_to_generic_definition()

spec/InverseFunctionalIdentifierSpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function it_can_be_built_with_an_mbox()
2323
{
2424
$iri = IRI::fromString('mailto:[email protected]');
2525
$this->beConstructedThrough(
26-
array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withMbox'),
26+
array(InverseFunctionalIdentifier::class, 'withMbox'),
2727
array($iri)
2828
);
2929

@@ -36,7 +36,7 @@ function it_can_be_built_with_an_mbox()
3636
function it_can_be_built_with_an_mbox_sha1_sum()
3737
{
3838
$this->beConstructedThrough(
39-
array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withMboxSha1Sum'),
39+
array(InverseFunctionalIdentifier::class, 'withMboxSha1Sum'),
4040
array('db77b9104b531ecbb0b967f6942549d0ba80fda1')
4141
);
4242

@@ -49,7 +49,7 @@ function it_can_be_built_with_an_mbox_sha1_sum()
4949
function it_can_be_built_with_an_openid()
5050
{
5151
$this->beConstructedThrough(
52-
array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withOpenId'),
52+
array(InverseFunctionalIdentifier::class, 'withOpenId'),
5353
array('http://openid.tincanapi.com')
5454
);
5555

@@ -63,7 +63,7 @@ function it_can_be_built_with_an_account()
6363
{
6464
$account = new Account('test', IRL::fromString('https://tincanapi.com'));
6565
$this->beConstructedThrough(
66-
array('Xabbuh\XApi\Model\InverseFunctionalIdentifier', 'withAccount'),
66+
array(InverseFunctionalIdentifier::class, 'withAccount'),
6767
array($account)
6868
);
6969

spec/LanguageMapSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function let()
1717

1818
function it_is_initializable()
1919
{
20-
$this->shouldHaveType('Xabbuh\XApi\Model\LanguageMap');
20+
$this->shouldHaveType(LanguageMap::class);
2121
}
2222

2323
function it_can_be_created_with_an_existing_array_map()

spec/StateDocumentSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PhpSpec\ObjectBehavior;
1515
use Xabbuh\XApi\Model\Activity;
1616
use Xabbuh\XApi\Model\Agent;
17+
use Xabbuh\XApi\Model\Document;
1718
use Xabbuh\XApi\Model\DocumentData;
1819
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
1920
use Xabbuh\XApi\Model\IRI;
@@ -33,7 +34,7 @@ function let()
3334

3435
function it_is_a_document()
3536
{
36-
$this->shouldHaveType('Xabbuh\XApi\Model\Document');
37+
$this->shouldHaveType(Document::class);
3738
}
3839

3940
function its_data_can_be_read()

spec/StatementIdSpec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class StatementIdSpec extends ObjectBehavior
2020
function it_can_be_created_from_a_uuid()
2121
{
2222
$this->beConstructedThrough('fromUuid', array(Uuid::fromString('39e24cc4-69af-4b01-a824-1fdc6ea8a3af')));
23-
$this->shouldBeAnInstanceOf('Xabbuh\XApi\Model\StatementId');
23+
$this->shouldBeAnInstanceOf(StatementId::class);
2424
}
2525

2626
function it_can_be_created_from_a_string()
2727
{
2828
$this->beConstructedThrough('fromString', array('39e24cc4-69af-4b01-a824-1fdc6ea8a3af'));
29-
$this->shouldBeAnInstanceOf('Xabbuh\XApi\Model\StatementId');
29+
$this->shouldBeAnInstanceOf(StatementId::class);
3030
}
3131

3232
function it_should_reject_malformed_uuids()

0 commit comments

Comments
 (0)