2019-02-14 03:27:47 +00:00
|
|
|
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
|
|
2018-11-24 03:25:56 +00:00
|
|
|
namespace ActivityPub\Test;
|
2019-02-16 17:51:24 +00:00
|
|
|
|
2018-11-20 11:29:09 +00:00
|
|
|
use ActivityPub\ActivityPub;
|
2019-01-23 23:34:25 +00:00
|
|
|
use ActivityPub\Config\ActivityPubConfig;
|
2019-01-20 03:37:07 +00:00
|
|
|
use ActivityPub\Test\TestConfig\ArrayDataSet;
|
2019-02-16 17:51:24 +00:00
|
|
|
use ActivityPub\Test\TestConfig\SQLiteTestCase;
|
2018-11-14 13:08:15 +00:00
|
|
|
|
2018-11-23 13:28:46 +00:00
|
|
|
class ActivityPubTest extends SQLiteTestCase
|
2018-11-19 12:14:58 +00:00
|
|
|
{
|
2019-02-16 17:51:24 +00:00
|
|
|
public function getDataSet()
|
|
|
|
{
|
2018-11-19 12:14:58 +00:00
|
|
|
return new ArrayDataSet( array() );
|
|
|
|
}
|
2019-02-16 17:51:24 +00:00
|
|
|
|
|
|
|
public function testItCreatesSchema()
|
|
|
|
{
|
2018-11-20 11:29:09 +00:00
|
|
|
$this->assertTrue( file_exists( $this->getDbPath() ) );
|
|
|
|
}
|
|
|
|
|
2019-03-23 16:57:41 +00:00
|
|
|
protected static function getDbPath()
|
2019-02-16 17:51:24 +00:00
|
|
|
{
|
|
|
|
return dirname( __FILE__ ) . '/db.sqlite';
|
|
|
|
}
|
|
|
|
|
2018-11-20 11:29:09 +00:00
|
|
|
/**
|
|
|
|
* @depends testItCreatesSchema
|
|
|
|
*/
|
2019-02-16 17:51:24 +00:00
|
|
|
public function testItUpdatesSchema()
|
|
|
|
{
|
2019-01-23 23:34:25 +00:00
|
|
|
$config = ActivityPubConfig::createBuilder()
|
2019-02-16 17:51:24 +00:00
|
|
|
->setDbConnectionParams( array(
|
|
|
|
'driver' => 'pdo_sqlite',
|
|
|
|
'path' => $this->getDbPath(),
|
|
|
|
) )
|
|
|
|
->build();
|
2019-01-23 23:34:25 +00:00
|
|
|
$activityPub = new ActivityPub( $config );
|
2018-11-20 11:29:09 +00:00
|
|
|
$activityPub->updateSchema();
|
|
|
|
$this->assertTrue( file_exists( $this->getDbPath() ) );
|
|
|
|
}
|
2018-11-14 13:08:15 +00:00
|
|
|
}
|
2019-02-07 03:48:00 +00:00
|
|
|
|