From 2b58bb4dfa4b79974445d6c7941ee0fcd2b03846 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 8 Jan 2019 10:14:42 -0500 Subject: [PATCH] Restructure tests --- test/ActivityPubTest.php | 2 +- test/Config/SQLiteTestCase.php | 54 ----------------------- test/{ => Crypto}/RsaKeypairTest.php | 2 +- test/{ => Entities}/EntityTest.php | 6 +-- test/{ => Objects}/ObjectsServiceTest.php | 6 +-- test/{ => Utils}/UtilTest.php | 2 +- 6 files changed, 9 insertions(+), 63 deletions(-) delete mode 100644 test/Config/SQLiteTestCase.php rename test/{ => Crypto}/RsaKeypairTest.php (98%) rename test/{ => Entities}/EntityTest.php (96%) rename test/{ => Objects}/ObjectsServiceTest.php (99%) rename test/{ => Utils}/UtilTest.php (98%) diff --git a/test/ActivityPubTest.php b/test/ActivityPubTest.php index 21450d6..4987db8 100644 --- a/test/ActivityPubTest.php +++ b/test/ActivityPubTest.php @@ -29,7 +29,7 @@ class ActivityPubTest extends SQLiteTestCase $this->assertTrue( file_exists( $this->getDbPath() ) ); } - private function getDbPath() { + protected function getDbPath() { return dirname( __FILE__ ) . '/db.sqlite'; } } diff --git a/test/Config/SQLiteTestCase.php b/test/Config/SQLiteTestCase.php deleted file mode 100644 index 3542a09..0000000 --- a/test/Config/SQLiteTestCase.php +++ /dev/null @@ -1,54 +0,0 @@ - array( - 'driver' => 'pdo_sqlite', - 'path' => $dbPath, - ), - ) ); - $activityPub->updateSchema(); - } - - protected function tearDown() - { - parent::tearDown(); - unlink( dirname( __FILE__ ) . '/../db.sqlite' ); - unset( $this->conn ); - unset( $this->pdo ); - } - - final public function getConnection() - { - if ( $this->conn === null ) { - if ( $this->pdo === null ) { - $this->dbPath = dirname( __FILE__ ) . '/../db.sqlite'; - $this->pdo = new \PDO( "sqlite:{$this->dbPath}" ); - } - $this->conn = $this->createDefaultDBConnection( $this->pdo, $this->dbPath ); - } - return $this->conn; - } -} -?> diff --git a/test/RsaKeypairTest.php b/test/Crypto/RsaKeypairTest.php similarity index 98% rename from test/RsaKeypairTest.php rename to test/Crypto/RsaKeypairTest.php index 2de80cf..a4a72a6 100644 --- a/test/RsaKeypairTest.php +++ b/test/Crypto/RsaKeypairTest.php @@ -1,5 +1,5 @@ setNamingStrategy( $namingStrategy ); $dbParams = array( 'driver' => 'pdo_sqlite', - 'path' => __DIR__ . '/db.sqlite', + 'path' => $this->getDbPath(), ); $this->entityManager = EntityManager::create( $dbParams, $dbConfig ); $this->dateTimeProvider = new TestDateTimeProvider( diff --git a/test/ObjectsServiceTest.php b/test/Objects/ObjectsServiceTest.php similarity index 99% rename from test/ObjectsServiceTest.php rename to test/Objects/ObjectsServiceTest.php index 92ebb4a..6fcd78c 100644 --- a/test/ObjectsServiceTest.php +++ b/test/Objects/ObjectsServiceTest.php @@ -1,5 +1,5 @@ setNamingStrategy( $namingStrategy ); $dbParams = array( 'driver' => 'pdo_sqlite', - 'path' => __DIR__ . '/db.sqlite', + 'path' => $this->getDbPath(), ); $this->entityManager = EntityManager::create( $dbParams, $dbConfig ); $this->dateTimeProvider = new TestDateTimeProvider( diff --git a/test/UtilTest.php b/test/Utils/UtilTest.php similarity index 98% rename from test/UtilTest.php rename to test/Utils/UtilTest.php index 47edf0e..4db33ae 100644 --- a/test/UtilTest.php +++ b/test/Utils/UtilTest.php @@ -1,5 +1,5 @@