*/ class WipeDataLoaderTest extends TestCase { protected $con = null; public function setUp() { $this->loadPropelQuickBuilder(); $schema = <<
SCHEMA; $builder = new \PropelQuickBuilder(); $builder->setSchema($schema); $this->con = $builder->build(); } public function testWipesExistingData() { $book = new \WipeTestBook(); $book ->setName('Armageddon is near') ->setSlug('armageddon-is-near') ->save($this->con) ; $savedBook = \WipeTestBookPeer::doSelectOne(new \Criteria(), $this->con); $this->assertInstanceOf('WipeTestBook', $savedBook, 'The fixture has been saved correctly.'); $builder = $this->getMockBuilder('Propel\PropelBundle\DataFixtures\Loader\WipeDataLoader'); $wipeout = $builder ->setMethods(array('loadMapBuilders')) ->disableOriginalConstructor() ->getMock() ; $dbMap = new \DatabaseMap('book'); $dbMap->addTableFromMapClass('WipeTestBookTableMap'); $reflection = new \ReflectionObject($wipeout); $property = $reflection->getProperty('dbMap'); $property->setAccessible(true); $property->setValue($wipeout, $dbMap); $wipeout ->expects($this->once()) ->method('loadMapBuilders') ; $wipeout->load(array(), 'book'); $this->assertCount(0, \WipeTestBookPeer::doSelect(new \Criteria(), $this->con)); } }