eZ\Publish\Core\Persistence\Legacy\Tests\TestCase::setUp PHP Method

setUp() public method

Resets the database on test setup, so we always operate on a clean database.
public setUp ( )
    public function setUp()
    {
        try {
            $handler = $this->getDatabaseHandler();
        } catch (PDOException $e) {
            $this->markTestSkipped('PDO session could not be created: ' . $e->getMessage());
        }
        $schema = __DIR__ . '/_fixtures/schema.' . $this->db . '.sql';
        $queries = array_filter(preg_split('(;\\s*$)m', file_get_contents($schema)));
        foreach ($queries as $query) {
            $handler->exec($query);
        }
        $this->resetSequences();
        // Set "global" static var, that we are behind the initial run
        self::$initial = false;
    }

Usage Example

コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     $this->locationGateway = $this->getMock('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Gateway');
     $this->locationMapper = $this->getMock('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Mapper');
     $this->treeHandler = $this->getMock('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\TreeHandler', array(), array(), '', false);
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Tests\TestCase::setUp