/**
  * Test that the down method will truncate all current fixture table data
  * and empty the fixtures array.
  *
  * @test
  * @return void
  */
 public function it_should_truncate_all_fixtures()
 {
     $this->fixture->setConfig(array('location' => __DIR__ . '/fixtures/standard'));
     $this->fixture->up();
     $this->fixture->down();
     list($userCount, $roleCount, $gameCount) = $this->getRecordCounts();
     $this->assertEmpty($this->fixture->getFixtures());
     $this->assertEquals(0, $userCount);
     $this->assertEquals(0, $roleCount);
     $this->assertEquals(0, $gameCount);
 }
Beispiel #2
0
 /**
  * Test that extra join columns for a HABTM fixture are being populated.
  *
  * @test
  * @return void
  */
 public function itShouldPopulateFixtureJoinColumnData()
 {
     $this->fixture->setConfig(array('location' => __DIR__ . '/fixtures/orm'));
     $this->fixture->up(array('users', 'roles'));
     $this->assertEquals(1, $this->fixture->users('Travis')->roles[0]->pivot->active);
     $this->assertEquals(0, $this->fixture->users('Travis')->roles[1]->pivot->active);
 }
Beispiel #3
0
 /**
  * Test that that up method throws an invalid fixture error if one of the fixtures
  * is not an array
  *
  * @test
  * @expectedException Codesleeve\Fixture\Exceptions\InvalidFixtureDataException
  * @return void
  */
 public function itShouldThrowAnExceptionIfTheFixtureIsNotAnArray()
 {
     $this->fixture->setConfig(array('location' => __DIR__ . '/invalid_fixtures'));
     $this->fixture->up();
 }
Beispiel #4
0
 /**
  * Test that that up method throws an invalid fixture error if one of the fixtures
  * is not an array
  *
  * @test
  * @expectedException Codesleeve\Fixture\Exceptions\InvalidFixtureDataException
  * @return void
  */
 public function it_should_throw_an_exception_if_the_fixture_is_not_an_array()
 {
     $this->fixture->setConfig(array('location' => __DIR__ . '/invalid_fixtures'));
     $this->fixture->up();
 }