activitypub-php/test/ActivityPubTest.php

44 lines
1.1 KiB
PHP
Raw Normal View History

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;
use ActivityPub\Config\ActivityPubConfig;
use ActivityPub\Test\TestConfig\ArrayDataSet;
2019-02-16 17:51:24 +00:00
use ActivityPub\Test\TestConfig\SQLiteTestCase;
2018-11-23 13:28:46 +00:00
class ActivityPubTest extends SQLiteTestCase
{
2019-02-16 17:51:24 +00:00
public function getDataSet()
{
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()
{
$config = ActivityPubConfig::createBuilder()
2019-02-16 17:51:24 +00:00
->setDbConnectionParams( array(
'driver' => 'pdo_sqlite',
'path' => $this->getDbPath(),
) )
->build();
$activityPub = new ActivityPub( $config );
2018-11-20 11:29:09 +00:00
$activityPub->updateSchema();
$this->assertTrue( file_exists( $this->getDbPath() ) );
}
}