Skip to content

Commit

Permalink
Fix namespace usage in SupportCollectionTest (#13593)
Browse files Browse the repository at this point in the history
* Use base collection class, not Eloquent version

* Use class constant to minimize future namespace errors
  • Loading branch information
besologic authored and taylorotwell committed May 18, 2016
1 parent 870fb0b commit b4d6416
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollecti

public function testToJsonEncodesTheJsonSerializeResult()
{
$c = $this->getMock('Illuminate\Support\Collection', ['jsonSerialize']);
$c = $this->getMock(Collection::class, ['jsonSerialize']);
$c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo'));
$results = $c->toJson();

Expand All @@ -146,7 +146,7 @@ public function testToJsonEncodesTheJsonSerializeResult()

public function testCastingToStringJsonEncodesTheToArrayResult()
{
$c = $this->getMock('Illuminate\Database\Eloquent\Collection', ['jsonSerialize']);
$c = $this->getMock(Collection::class, ['jsonSerialize']);
$c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo'));

$this->assertJsonStringEqualsJsonString(json_encode('foo'), (string) $c);
Expand Down Expand Up @@ -551,8 +551,8 @@ public function testChunk()
$data = new Collection([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
$data = $data->chunk(3);

$this->assertInstanceOf('Illuminate\Support\Collection', $data);
$this->assertInstanceOf('Illuminate\Support\Collection', $data[0]);
$this->assertInstanceOf(Collection::class, $data);
$this->assertInstanceOf(Collection::class, $data[0]);
$this->assertCount(4, $data);
$this->assertEquals([1, 2, 3], $data[0]->toArray());
$this->assertEquals([9 => 10], $data[3]->toArray());
Expand Down Expand Up @@ -631,7 +631,7 @@ public function testRandom()
$this->assertContains($random, $data->all());

$random = $data->random(3);
$this->assertInstanceOf('Illuminate\Support\Collection', $random);
$this->assertInstanceOf(Collection::class, $random);
$this->assertCount(3, $random);
}

Expand Down Expand Up @@ -1091,10 +1091,10 @@ public function testZip()
{
$c = new Collection([1, 2, 3]);
$c = $c->zip(new Collection([4, 5, 6]));
$this->assertInstanceOf('Illuminate\Support\Collection', $c);
$this->assertInstanceOf('Illuminate\Support\Collection', $c[0]);
$this->assertInstanceOf('Illuminate\Support\Collection', $c[1]);
$this->assertInstanceOf('Illuminate\Support\Collection', $c[2]);
$this->assertInstanceOf(Collection::class, $c);
$this->assertInstanceOf(Collection::class, $c[0]);
$this->assertInstanceOf(Collection::class, $c[1]);
$this->assertInstanceOf(Collection::class, $c[2]);
$this->assertCount(3, $c);
$this->assertEquals([1, 4], $c[0]->all());
$this->assertEquals([2, 5], $c[1]->all());
Expand Down

0 comments on commit b4d6416

Please sign in to comment.