Skip to content

Commit

Permalink
Cleanup GraphNodeTest
Browse files Browse the repository at this point in the history
  • Loading branch information
yguedidi committed Dec 19, 2017
1 parent 0673ccd commit c0e5c24
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions tests/GraphNode/GraphNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testAGraphNodeCanInstantiateWithData()
/**
* @dataProvider provideDateTimeFieldNames
*/
public function testIsCastDateTimeFieldsToDateTime($fieldName)
public function testCastDateTimeFieldsToDateTime($fieldName)
{
$graphNode = new GraphNode([$fieldName => '1989-11-02']);

Expand All @@ -69,7 +69,7 @@ public static function provideDateTimeFieldNames()
/**
* @dataProvider provideValidDateTimeFieldValues
*/
public function testIsCastDateTimeFieldValueToDateTime($value, $message, $prettyDate = null)
public function testCastDateTimeFieldValueToDateTime($value, $message, $prettyDate = null)
{
$graphNode = new GraphNode(['created_time' => $value]);

Expand All @@ -93,7 +93,7 @@ public static function provideValidDateTimeFieldValues()
/**
* @dataProvider provideInvalidDateTimeFieldValues
*/
public function testIsNotCastDateTimeFieldValueToDateTime($value, $message)
public function testNotCastDateTimeFieldValueToDateTime($value, $message)
{
$graphNode = new GraphNode(['created_time' => $value]);

Expand Down Expand Up @@ -130,23 +130,23 @@ public function testGettingAGraphNodeAsAStringWillSafelyRepresentDateTimes()
$this->assertEquals('{"id":"123","created_time":"2014-07-15T03:44:53+0000"}', $graphNodeAsString);
}

public function testAnExistingPropertyCanBeAccessed()
public function testAnExistingFieldCanBeAccessed()
{
$graphNode = new GraphNode(['foo' => 'bar']);

$field = $graphNode->getField('foo');
$this->assertEquals('bar', $field);
}

public function testAMissingPropertyWillReturnNull()
public function testAMissingFieldWillReturnNull()
{
$graphNode = new GraphNode(['foo' => 'bar']);
$field = $graphNode->getField('baz');

$this->assertNull($field, 'Expected the property to return null.');
}

public function testAMissingPropertyWillReturnTheDefault()
public function testAMissingFieldWillReturnTheDefault()
{
$graphNode = new GraphNode(['foo' => 'bar']);

Expand All @@ -168,22 +168,16 @@ public function testFalseDefaultsWillReturnSameType()
$this->assertFalse($field);
}

public function testTheKeysFromTheCollectionCanBeReturned()
public function testTheFieldsFromTheGraphNodeCanBeReturned()
{
$graphNode = new GraphNode([
'key1' => 'foo',
'key2' => 'bar',
'key3' => 'baz',
'field1' => 'foo',
'field2' => 'bar',
'field3' => 'baz',
]);

$fieldNames = $graphNode->getFieldNames();
$this->assertEquals(['key1', 'key2', 'key3'], $fieldNames);
}

public function testAnArrayCanBeInjectedViaTheConstructor()
{
$graphNode = new GraphNode(['foo', 'bar']);
$this->assertEquals(['foo', 'bar'], $graphNode->asArray());
$this->assertEquals(['field1', 'field2', 'field3'], $fieldNames);
}

public function testAGraphNodeCanBeConvertedToAString()
Expand All @@ -195,15 +189,15 @@ public function testAGraphNodeCanBeConvertedToAString()
$this->assertEquals('["foo","bar",123]', $graphNodeAsString);
}

public function testACollectionCanBeAccessedAsAnArray()
public function testAGraphNodeCanBeAccessedAsAnArray()
{
$graphNode = new GraphNode(['foo' => 'bar', 'faz' => 'baz']);

$this->assertEquals('bar', $graphNode['foo']);
$this->assertEquals('baz', $graphNode['faz']);
}

public function testACollectionCanBeIteratedOver()
public function testAGraphNodeCanBeIteratedOver()
{
$graphNode = new GraphNode(['foo' => 'bar', 'faz' => 'baz']);

Expand Down

0 comments on commit c0e5c24

Please sign in to comment.