From d088bbce28358ae1716748e56093c7dbc0b4de5a Mon Sep 17 00:00:00 2001 From: lucaszz Date: Mon, 5 Oct 2015 20:09:30 +0200 Subject: [PATCH] Readme updated, method order corrected --- README.md | 7 ++++--- tests/Integration/ExampleTest.php | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8022624..34e221a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Description -------- DoctrineDatabaseBackup is simple library for speed up tests in your app. +It could be used for **PHPUnit** tests or **Behat** tests running from command line. My target was to avoid wasting time for dropping/creating or purging database for each test, so I optimized it. From my own benchmarks I can see that DoctrineDatabaseBackup can reduce the time of execution tests up to 3 times. @@ -21,10 +22,10 @@ Requirements Features -------- -- It supports SqlitePlatform and MySqlPlatform, +- It supports **SqlitePlatform** and **MySqlPlatform**, - It can create database backup per PHP process, - It can clear database in fast way, -- It can restore database from backup in every test, +- It can restore database from backup before every test, - Because I decided to expose methods "isCreated", "create", "restore" and "clearDatabase" usages of this library can be very various. Installation @@ -59,7 +60,7 @@ Usage (PHPUnit example) ``` [Full working example](https://github.com/Lucaszz/DoctrineDatabaseBackup/blob/master/tests/Integration/ExampleTest.php) -Notice that before first test of PHP process database should be created. +**Notice that before first test of PHP process database should be created.** Behat example -------- diff --git a/tests/Integration/ExampleTest.php b/tests/Integration/ExampleTest.php index 3b79bbf..e54a624 100644 --- a/tests/Integration/ExampleTest.php +++ b/tests/Integration/ExampleTest.php @@ -33,6 +33,15 @@ public function testThatDatabaseIsClearBeforeNextTest() $this->assertCount(1, $this->entityManager->getRepository('\Lucaszz\DoctrineDatabaseBackup\tests\Integration\Entity\TestProduct')->findAll()); } + /** + * Before first test of PHP process database should be created. + */ + public static function setUpBeforeClass() + { + $entityManager = self::createEntityManager(); + self::setupDatabase($entityManager); + } + /** * {@inheritdoc} */ @@ -60,15 +69,6 @@ protected function tearDown() $this->entityManager = null; } - /** - * Before first test of PHP process database should be created. - */ - public static function setUpBeforeClass() - { - $entityManager = self::createEntityManager(); - self::setupDatabase($entityManager); - } - /** * Example of creating EntityManager. */