Skip to content

Commit

Permalink
Clean up tests, refs nelmio#69
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Oct 31, 2013
1 parent 1fd69be commit 1d31cd1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 107 deletions.
25 changes: 11 additions & 14 deletions tests/Nelmio/Alice/FixturesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@ public function testLoadLoadsYamlFilesAndDoctrineORM()
{
$om = $this->getDoctrineManagerMock(14);
$objects = Fixtures::load(__DIR__.'/fixtures/complete.yml', $om, array('providers' => array($this)));
$objects = array_values($objects);


$this->assertCount(14, $objects);

$user = $objects[0];
$user = $objects['user0'];
$this->assertInstanceOf(self::USER, $user);
$this->assertEquals('johnny', $user->username);
$this->assertEquals(42, $user->favoriteNumber);

$user = $objects[0];
$group = $objects[12];
$user = $objects['user0'];
$group = $objects['group0'];
$this->assertSame($user, $group->getOwner());

$lastGroup = end($objects);
$lastGroup = $objects['group1'];
$this->assertInstanceOf(self::GROUP, $lastGroup);
$this->assertCount(3, $lastGroup->getMembers());

$contact = $objects[11];
$contact = $objects['contact0'];
$this->assertInstanceOf(self::CONTACT, $contact);
$this->assertSame($user, $contact->getUser());
$this->assertSame($lastGroup->contactPerson, $contact->getUser());
Expand Down Expand Up @@ -248,11 +247,10 @@ public function testLoadLoadsArrays()
),

), $om);
$objects = array_values($objects);


$this->assertCount(2, $objects);
$user = $objects[0];

$user = $objects['user1'];
$this->assertInstanceOf(self::USER, $user);
$this->assertEquals('johnny', $user->username);
$this->assertEquals(42, $user->favoriteNumber);
Expand All @@ -263,11 +261,10 @@ public function testLoadLoadsPHPfiles()
$om = $this->getDoctrineManagerMock(2);

$objects = Fixtures::load(__DIR__.'/fixtures/basic.php', $om);
$objects = array_values($objects);


$this->assertCount(2, $objects);

$user = $objects[0];
$user = $objects['user1'];
$this->assertInstanceOf(self::USER, $user);
$this->assertEquals('johnny', $user->username);
$this->assertEquals(42, $user->favoriteNumber);
Expand Down
Loading

0 comments on commit 1d31cd1

Please sign in to comment.