diff --git a/composer.json b/composer.json index db277d2c5..0ab437819 100644 --- a/composer.json +++ b/composer.json @@ -3,8 +3,8 @@ "description": "A web based interface for viewing profile data collected by XHProf", "license": "MIT", "autoload": { - "psr-0": { - "Xhgui_": "src/" + "psr-4": { + "XHGui\\": "src/Xhgui/" } }, "autoload-dev": { diff --git a/external/import.php b/external/import.php index 3abc34c64..b148b1bcc 100644 --- a/external/import.php +++ b/external/import.php @@ -1,4 +1,8 @@ searcher = $searcher; diff --git a/src/Xhgui/Controller/Import.php b/src/Xhgui/Controller/ImportController.php similarity index 81% rename from src/Xhgui/Controller/Import.php rename to src/Xhgui/Controller/ImportController.php index efdcfe92a..67eef4665 100644 --- a/src/Xhgui/Controller/Import.php +++ b/src/Xhgui/Controller/ImportController.php @@ -1,19 +1,25 @@ saver = $saver; diff --git a/src/Xhgui/Controller/Metrics.php b/src/Xhgui/Controller/MetricsController.php similarity index 81% rename from src/Xhgui/Controller/Metrics.php rename to src/Xhgui/Controller/MetricsController.php index 2ff071090..bd8c974ba 100644 --- a/src/Xhgui/Controller/Metrics.php +++ b/src/Xhgui/Controller/MetricsController.php @@ -1,15 +1,19 @@ searcher = $searcher; diff --git a/src/Xhgui/Controller/Run.php b/src/Xhgui/Controller/RunController.php similarity index 97% rename from src/Xhgui/Controller/Run.php rename to src/Xhgui/Controller/RunController.php index 1ec0474ba..f09475211 100644 --- a/src/Xhgui/Controller/Run.php +++ b/src/Xhgui/Controller/RunController.php @@ -1,8 +1,13 @@ searcher = $searcher; diff --git a/src/Xhgui/Controller/Watch.php b/src/Xhgui/Controller/WatchController.php similarity index 75% rename from src/Xhgui/Controller/Watch.php rename to src/Xhgui/Controller/WatchController.php index 6b2eb1d3f..c2b53711c 100644 --- a/src/Xhgui/Controller/Watch.php +++ b/src/Xhgui/Controller/WatchController.php @@ -1,15 +1,19 @@ searcher = $searcher; diff --git a/src/Xhgui/Controller/Waterfall.php b/src/Xhgui/Controller/WaterfallController.php similarity index 87% rename from src/Xhgui/Controller/Waterfall.php rename to src/Xhgui/Controller/WaterfallController.php index 663a8d44b..9c32f8314 100644 --- a/src/Xhgui/Controller/Waterfall.php +++ b/src/Xhgui/Controller/WaterfallController.php @@ -1,15 +1,20 @@ searcher = $searcher; @@ -64,7 +69,7 @@ public function query() 'projection' => true, ]); $datas = []; - /** @var Xhgui_Profile $r */ + /** @var Profile $r */ foreach ($result['results'] as $r) { $duration = $r->get('main()', 'wt'); $start = $r->getMeta('SERVER.REQUEST_TIME_FLOAT'); diff --git a/src/Xhgui/Db/Mapper.php b/src/Xhgui/Db/Mapper.php index bd51f47a6..135eeba71 100644 --- a/src/Xhgui/Db/Mapper.php +++ b/src/Xhgui/Db/Mapper.php @@ -1,6 +1,12 @@ $item) { foreach ($profileData as $keyItem => $method) { if (fnmatch($item, $keyItem)) { - unset($profileData[ $keyItem ]); + unset($profileData[$keyItem]); } } } @@ -478,10 +484,10 @@ public function getFunctionCount() /** * Compare this run to another run. * - * @param Xhgui_Profile $head The other run to compare with + * @param Profile $head The other run to compare with * @return array An array of comparison data. */ - public function compare(Xhgui_Profile $head) + public function compare(Profile $head) { $this->calculateSelf(); $head->calculateSelf(); diff --git a/src/Xhgui/Saver/Mongo.php b/src/Xhgui/Saver/MongoSaver.php similarity index 92% rename from src/Xhgui/Saver/Mongo.php rename to src/Xhgui/Saver/MongoSaver.php index dd9c5cdfa..09d12791d 100644 --- a/src/Xhgui/Saver/Mongo.php +++ b/src/Xhgui/Saver/MongoSaver.php @@ -1,6 +1,12 @@ stmt->execute([ - 'id' => Xhgui_Util::generateId(), + 'id' => Util::generateId(), 'profile' => json_encode($data['profile']), 'url' => $data['meta']['url'], 'SERVER' => json_encode($data['meta']['SERVER']), diff --git a/src/Xhgui/Saver/Interface.php b/src/Xhgui/Saver/SaverInterface.php similarity index 50% rename from src/Xhgui/Saver/Interface.php rename to src/Xhgui/Saver/SaverInterface.php index 23c9efa9f..c9a9de4ae 100644 --- a/src/Xhgui/Saver/Interface.php +++ b/src/Xhgui/Saver/SaverInterface.php @@ -1,6 +1,8 @@ _collection = $db->results; $this->_watches = $db->watches; - $this->_mapper = new Xhgui_Db_Mapper(); + $this->_mapper = new Mapper(); } /** @@ -322,10 +332,10 @@ private function paginate($options) } /** - * Converts arrays + MongoCursors into Xhgui_Profile instances. + * Converts arrays + MongoCursors into Profile instances. * * @param array|MongoCursor $data The data to transform. - * @return Xhgui_Profile|Xhgui_Profile[] The transformed/wrapped results. + * @return Profile|Profile[] The transformed/wrapped results. */ private function _wrap($data) { @@ -334,11 +344,11 @@ private function _wrap($data) } if (is_array($data)) { - return new Xhgui_Profile($data); + return new Profile($data); } $results = []; foreach ($data as $row) { - $results[] = new Xhgui_Profile($row); + $results[] = new Profile($row); } return $results; diff --git a/src/Xhgui/Searcher/Pdo.php b/src/Xhgui/Searcher/PdoSearcher.php similarity index 97% rename from src/Xhgui/Searcher/Pdo.php rename to src/Xhgui/Searcher/PdoSearcher.php index 1cb763dad..08fb4f3d7 100644 --- a/src/Xhgui/Searcher/Pdo.php +++ b/src/Xhgui/Searcher/PdoSearcher.php @@ -1,6 +1,12 @@ $row['id'], 'meta' => [ 'url' => $row['url'], @@ -99,7 +105,7 @@ public function get($id) throw new Exception('No profile data found.'); } - return new Xhgui_Profile([ + return new Profile([ '_id' => $id, 'meta' => [ 'url' => $row['url'], @@ -192,7 +198,7 @@ public function getAll($options = []) $results = []; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $results[] = new Xhgui_Profile([ + $results[] = new Profile([ '_id' => $row['id'], 'meta' => [ 'url' => $row['url'], diff --git a/src/Xhgui/Searcher/Interface.php b/src/Xhgui/Searcher/SearcherInterface.php similarity index 94% rename from src/Xhgui/Searcher/Interface.php rename to src/Xhgui/Searcher/SearcherInterface.php index d9869838f..51e34b24a 100644 --- a/src/Xhgui/Searcher/Interface.php +++ b/src/Xhgui/Searcher/SearcherInterface.php @@ -1,14 +1,20 @@ -1 ????) * - direction: an string, either 'desc' or 'asc' * - page: an integer, the page to display (e.g. 3) diff --git a/src/Xhgui/ServiceContainer.php b/src/Xhgui/ServiceContainer.php index c472bd782..ff60c7428 100644 --- a/src/Xhgui/ServiceContainer.php +++ b/src/Xhgui/ServiceContainer.php @@ -1,12 +1,21 @@ add(new Xhgui_Middleware_Render()); + $app->add(new RenderMiddleware()); $view = $c['view']; $view->parserExtensions = [ - new Xhgui_Twig_Extension($app), + new TwigExtension($app), ]; $app->view($view); @@ -82,7 +91,7 @@ protected function _slimApp() */ protected function _services() { - $this['config'] = Xhgui_Config::all(); + $this['config'] = Config::all(); $this['db'] = static function ($c) { $config = $c['config']; @@ -112,11 +121,11 @@ protected function _services() }; $this['searcher.mongodb'] = static function ($c) { - return new Xhgui_Searcher_Mongo($c['db']); + return new MongoSearcher($c['db']); }; $this['searcher.pdo'] = static function ($c) { - return new Xhgui_Searcher_Pdo($c['pdo'], $c['config']['pdo']['table']); + return new PdoSearcher($c['pdo'], $c['config']['pdo']['table']); }; $this['searcher'] = static function ($c) { @@ -135,7 +144,7 @@ protected function _services() $collection = $mongo->{$config['db.db']}->results; $collection->findOne(); - return new Xhgui_Saver_Mongo($collection); + return new Saver\MongoSaver($collection); }; $this['saver.pdo'] = static function ($c) { @@ -149,7 +158,7 @@ protected function _services() PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]; - return new Xhgui_Saver_Pdo( + return new Saver\PdoSaver( new PDO( $config['pdo']['dsn'], $config['pdo']['user'], @@ -173,27 +182,27 @@ protected function _services() protected function _controllers() { $this['watchController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Watch($c['app'], $c['searcher']); + return new Controller\WatchController($c['app'], $c['searcher']); }); $this['runController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Run($c['app'], $c['searcher']); + return new Controller\RunController($c['app'], $c['searcher']); }); $this['customController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Custom($c['app'], $c['searcher']); + return new Controller\CustomController($c['app'], $c['searcher']); }); $this['waterfallController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Waterfall($c['app'], $c['searcher']); + return new Controller\WaterfallController($c['app'], $c['searcher']); }); $this['importController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Import($c['app'], $c['saver'], $c['config']['upload.token']); + return new Controller\ImportController($c['app'], $c['saver'], $c['config']['upload.token']); }); $this['metricsController'] = $this->factory(static function ($c) { - return new Xhgui_Controller_Metrics($c['app'], $c['searcher']); + return new Controller\MetricsController($c['app'], $c['searcher']); }); } } diff --git a/src/Xhgui/Twig/Extension.php b/src/Xhgui/Twig/TwigExtension.php similarity index 96% rename from src/Xhgui/Twig/Extension.php rename to src/Xhgui/Twig/TwigExtension.php index ee759da75..304e59a87 100755 --- a/src/Xhgui/Twig/Extension.php +++ b/src/Xhgui/Twig/TwigExtension.php @@ -1,9 +1,14 @@ error(static function (Exception $e) use ($di, $app) { /** @var Twig $view */ $view = $di['view']; $view->parserOptions['cache'] = false; $view->parserExtensions = [ - new Xhgui_Twig_Extension($app), + new TwigExtension($app), ]; // Remove the controller so we don't render it. @@ -91,7 +94,7 @@ // Import route $app->post('/run/import', static function () use ($di, $app) { - /** @var Xhgui_Controller_Import $controller */ + /** @var ImportController $controller */ $controller = $di['importController']; $controller->import(); })->name('run.import'); diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index e8d63d47b..4df7c12d1 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -2,39 +2,39 @@ namespace XHGui\Test; -use Xhgui_Config; +use XHGui\Config; class ConfigTest extends TestCase { public function setUp() { parent::setUp(); - Xhgui_Config::clear(); + Config::clear(); } public function testReadWrite() { - $result = Xhgui_Config::write('test', 'value'); + $result = Config::write('test', 'value'); $this->assertNull($result); - $result = Xhgui_Config::read('test'); + $result = Config::read('test'); $this->assertEquals('value', $result); - $result = Xhgui_Config::read('not there'); + $result = Config::read('not there'); $this->assertNull($result); } public function testReadWriteWithDots() { - $result = Xhgui_Config::write('test.name', 'value'); - $this->assertNull(Xhgui_Config::read('test')); - $this->assertEquals('value', Xhgui_Config::read('test.name')); + $result = Config::write('test.name', 'value'); + $this->assertNull(Config::read('test')); + $this->assertEquals('value', Config::read('test.name')); } public function testClear() { - Xhgui_Config::write('test', 'value'); - $this->assertNull(Xhgui_Config::clear()); - $this->assertNull(Xhgui_Config::read('test')); + Config::write('test', 'value'); + $this->assertNull(Config::clear()); + $this->assertNull(Config::read('test')); } } diff --git a/tests/Controller/ImportTest.php b/tests/Controller/ImportTest.php index 1c63b94b2..be32a1b0c 100644 --- a/tests/Controller/ImportTest.php +++ b/tests/Controller/ImportTest.php @@ -2,19 +2,19 @@ namespace XHGui\Test\Controller; -use Slim\Slim; use Slim\Environment; +use Slim\Slim; +use XHGui\Controller\ImportController; +use XHGui\Searcher\SearcherInterface; use XHGui\Test\TestCase; -use Xhgui_Controller_Import; -use Xhgui_Profile; -use Xhgui_Searcher_Interface; -use Xhgui_ServiceContainer; +use XHGui\Profile; +use XHGui\ServiceContainer; class ImportTest extends TestCase { - /** @var Xhgui_Searcher_Interface */ + /** @var SearcherInterface */ private $profiles; - /** @var Xhgui_Controller_Import */ + /** @var ImportController */ private $import; public function setUp() @@ -25,7 +25,7 @@ public function setUp() 'PATH_INFO' => '/', ]); - $di = Xhgui_ServiceContainer::instance(); + $di = ServiceContainer::instance(); $di['app'] = $this->getMockBuilder(Slim::class) ->setMethods(['redirect', 'render', 'urlFor']) ->setConstructorArgs([$di['config']]) @@ -70,6 +70,6 @@ public function testImportSuccess() $after = $this->profiles->getForUrl('/things', []); $this->assertNotEmpty($after['results']); - $this->assertInstanceOf(Xhgui_Profile::class, $after['results'][0]); + $this->assertInstanceOf(Profile::class, $after['results'][0]); } } diff --git a/tests/Controller/RunTest.php b/tests/Controller/RunTest.php index e76d15a4c..cc1449053 100644 --- a/tests/Controller/RunTest.php +++ b/tests/Controller/RunTest.php @@ -2,26 +2,26 @@ namespace XHGui\Test\Controller; -use Slim\Slim; use Slim\Environment; +use Slim\Slim; +use XHGui\Controller\ImportController; +use XHGui\Controller\RunController; +use XHGui\Saver\MongoSaver; +use XHGui\Searcher\MongoSearcher; use XHGui\Test\TestCase; -use Xhgui_Controller_Import; -use Xhgui_Controller_Run; -use Xhgui_Saver_Mongo; -use Xhgui_Searcher_Mongo; -use Xhgui_ServiceContainer; +use XHGui\ServiceContainer; class RunTest extends TestCase { - /** @var Xhgui_Controller_Run */ + /** @var RunController */ private $runs; - /** @var Xhgui_Saver_Mongo */ + /** @var MongoSaver */ private $saver; /** @var Slim */ private $app; - /** @var Xhgui_Searcher_Mongo */ + /** @var MongoSearcher */ private $profiles; - /** @var Xhgui_Controller_Import */ + /** @var ImportController */ private $import; public function setUp() @@ -32,7 +32,7 @@ public function setUp() 'PATH_INFO' => '/', ]); - $di = Xhgui_ServiceContainer::instance(); + $di = ServiceContainer::instance(); $di['app'] = $this->getMockBuilder(Slim::class) ->setMethods(['redirect', 'render', 'urlFor']) ->setConstructorArgs([$di['config']]) diff --git a/tests/Controller/WatchTest.php b/tests/Controller/WatchTest.php index f29f30d2a..1a7670638 100644 --- a/tests/Controller/WatchTest.php +++ b/tests/Controller/WatchTest.php @@ -3,19 +3,19 @@ namespace XHGui\Test\Controller; use Slim\Environment; -use XHGui\Test\TestCase; -use Xhgui_Controller_Watch; -use Xhgui_Searcher_Interface; -use Xhgui_ServiceContainer; use Slim\Slim; +use XHGui\Controller\WatchController; +use XHGui\Searcher\SearcherInterface; +use XHGui\Test\TestCase; +use XHGui\ServiceContainer; class WatchTest extends TestCase { - /** @var Xhgui_Controller_Watch */ + /** @var WatchController */ private $watches; /** @var Slim */ private $app; - /** @var Xhgui_Searcher_Interface */ + /** @var SearcherInterface */ private $searcher; public function setUp() @@ -26,7 +26,7 @@ public function setUp() 'PATH_INFO' => '/watch', ]); - $di = Xhgui_ServiceContainer::instance(); + $di = ServiceContainer::instance(); $di['app'] = $this->getMockBuilder(Slim::class) ->setMethods(['redirect', 'render', 'urlFor']) ->setConstructorArgs([$di['config']]) diff --git a/tests/Db/MapperTest.php b/tests/Db/MapperTest.php index 76be4f0c8..afa387e08 100644 --- a/tests/Db/MapperTest.php +++ b/tests/Db/MapperTest.php @@ -5,18 +5,18 @@ use DateInterval; use DateTime; use MongoDate; +use XHGui\Db\Mapper; use XHGui\Test\TestCase; -use Xhgui_Db_Mapper; class MapperTest extends TestCase { - /** @var Xhgui_Db_Mapper */ + /** @var Mapper */ private $mapper; public function setUp() { parent::setUp(); - $this->mapper = new Xhgui_Db_Mapper(); + $this->mapper = new Mapper(); } public function testConvertConditions() diff --git a/tests/ProfileTest.php b/tests/ProfileTest.php index 1f64b4eb6..fbef069c8 100644 --- a/tests/ProfileTest.php +++ b/tests/ProfileTest.php @@ -3,7 +3,7 @@ namespace XHGui\Test; use DateTime; -use Xhgui_Profile; +use XHGui\Profile; class ProfileTest extends TestCase { @@ -26,7 +26,7 @@ public function testProcessIncompleteData() 'cpu' => 1, ], ]; - $profile = new Xhgui_Profile(['profile' => $data]); + $profile = new Profile(['profile' => $data]); $this->assertNotEmpty($profile->get('do_thing()')); } @@ -84,7 +84,7 @@ public function testGetRelatives() 'pmu' => 1, ], ]; - $profile = new Xhgui_Profile(['profile' => $data]); + $profile = new Profile(['profile' => $data]); $result = $profile->getRelatives('not there at all'); $this->assertCount(3, $result); @@ -168,7 +168,7 @@ public function testGetRelativesWithThreshold() 'pmu' => 1, ], ]; - $profile = new Xhgui_Profile(['profile' => $data]); + $profile = new Profile(['profile' => $data]); $result = $profile->getRelatives('other_func', 'wt', 0.1); $this->assertCount(3, $result); @@ -184,7 +184,7 @@ public function testGetRelativesWithThreshold() public function testGet() { $fixture = $this->fixture[0]; - $profile = new Xhgui_Profile($fixture); + $profile = new Profile($fixture); $this->assertEquals($fixture['profile']['main()']['wt'], $profile->get('main()', 'wt')); $expected = $fixture['profile']['main()']; @@ -199,7 +199,7 @@ public function testGet() public function testGetMeta() { $fixture = $this->fixture[0]; - $profile = new Xhgui_Profile($fixture); + $profile = new Profile($fixture); $this->assertEquals($fixture['meta'], $profile->getMeta()); @@ -212,7 +212,7 @@ public function testGetMeta() public function testExtractDimension() { - $profile = new Xhgui_Profile($this->fixture[0]); + $profile = new Profile($this->fixture[0]); $result = $profile->extractDimension('mu', 1); $this->assertCount(1, $result); @@ -225,7 +225,7 @@ public function testExtractDimension() public function testCalculateSelf() { - $profile = new Xhgui_Profile($this->fixture[1]); + $profile = new Profile($this->fixture[1]); $result = $profile->calculateSelf()->getProfile(); $main = $result['main()']; @@ -250,7 +250,7 @@ public function testSort() 'mu' => 34567, ], ]; - $profile = new Xhgui_Profile([]); + $profile = new Profile([]); $result = $profile->sort('mu', $data); $expected = [ @@ -267,7 +267,7 @@ public function testSort() public function testGetWatched() { $fixture = $this->fixture[0]; - $profile = new Xhgui_Profile($fixture); + $profile = new Profile($fixture); $data = $profile->getProfile(); $this->assertEmpty($profile->getWatched('not there')); @@ -294,7 +294,7 @@ public function testGetWatched() public function testGetFunctionCount() { $fixture = $this->fixture[0]; - $profile = new Xhgui_Profile($fixture); + $profile = new Profile($fixture); $this->assertEquals(11, $profile->getFunctionCount()); } @@ -302,8 +302,8 @@ public function testGetFunctionCount() public function testCompareAllTheSame() { $fixture = $this->fixture[0]; - $base = new Xhgui_Profile($fixture); - $head = new Xhgui_Profile($fixture); + $base = new Profile($fixture); + $head = new Profile($fixture); $result = $base->compare($head); @@ -323,8 +323,8 @@ public function testCompareAllTheSame() public function testCompareWithDifferences() { $fixture = $this->fixture[0]; - $base = new Xhgui_Profile($this->fixture[3]); - $head = new Xhgui_Profile($this->fixture[4]); + $base = new Profile($this->fixture[3]); + $head = new Profile($this->fixture[4]); $result = $base->compare($head); $this->assertEquals(0, $result['diff']['main()']['ct']); @@ -345,7 +345,7 @@ public function testCompareWithDifferences() public function testGetCallgraph() { - $profile = new Xhgui_Profile($this->fixture[1]); + $profile = new Profile($this->fixture[1]); $expected = [ 'metric' => 'wt', @@ -421,7 +421,7 @@ public function testGetCallgraph() public function testGetCallgraphNoDuplicates() { - $profile = new Xhgui_Profile($this->fixture[2]); + $profile = new Profile($this->fixture[2]); $expected = [ 'metric' => 'wt', @@ -492,7 +492,7 @@ public function testGetDateFallback() 'SERVER' => [], ], ]; - $profile = new Xhgui_Profile($data); + $profile = new Profile($data); $result = $profile->getDate(); $this->assertInstanceOf(DateTime::class, $result); } diff --git a/tests/Saver/MongoTest.php b/tests/Saver/MongoTest.php index ff581be4d..aa33095e8 100644 --- a/tests/Saver/MongoTest.php +++ b/tests/Saver/MongoTest.php @@ -3,8 +3,8 @@ namespace XHGui\Test\Saver; use MongoCollection; +use XHGui\Saver\MongoSaver; use XHGui\Test\TestCase; -use Xhgui_Saver_Mongo; class MongoTest extends TestCase { @@ -19,7 +19,7 @@ public function testSave() ->method('insert') ->withConsecutive($this->equalTo($data)); - $saver = new Xhgui_Saver_Mongo($collection); + $saver = new MongoSaver($collection); foreach ($data as $profile) { $saver->save($profile); diff --git a/tests/Searcher/MongoTest.php b/tests/Searcher/MongoTest.php index c02074427..398119e9f 100644 --- a/tests/Searcher/MongoTest.php +++ b/tests/Searcher/MongoTest.php @@ -2,21 +2,21 @@ namespace XHGui\Test\Searcher; +use XHGui\Profile; +use XHGui\Searcher\MongoSearcher; +use XHGui\ServiceContainer; use XHGui\Test\TestCase; -use Xhgui_Profile; -use Xhgui_Searcher_Mongo; -use Xhgui_ServiceContainer; class MongoTest extends TestCase { /** - * @var Xhgui_Searcher_Mongo + * @var MongoSearcher */ private $mongo; public function setUp() { - $di = Xhgui_ServiceContainer::instance(); + $di = ServiceContainer::instance(); $this->mongo = $di['searcher.mongodb']; $di['db']->watches->drop(); @@ -45,7 +45,7 @@ public function testGetForUrl() $this->assertEquals(1, $result['perPage']); $this->assertCount(1, $result['results']); - $this->assertInstanceOf(Xhgui_Profile::class, $result['results'][0]); + $this->assertInstanceOf(Profile::class, $result['results'][0]); $result = $this->mongo->getForUrl('/not-there', $options); $this->assertCount(0, $result['results']); @@ -139,7 +139,7 @@ public function testGetAllConditions() public function testLatest() { $result = $this->mongo->latest(); - $this->assertInstanceOf(Xhgui_Profile::class, $result); + $this->assertInstanceOf(Profile::class, $result); $this->assertEquals('2013-01-21', $result->getDate()->format('Y-m-d')); } diff --git a/tests/Twig/ExtensionTest.php b/tests/Twig/ExtensionTest.php index ffe2945bf..1a5ff7c9a 100755 --- a/tests/Twig/ExtensionTest.php +++ b/tests/Twig/ExtensionTest.php @@ -5,11 +5,11 @@ use Slim\Environment; use Slim\Slim; use XHGui\Test\TestCase; -use Xhgui_Twig_Extension; +use XHGui\Twig\TwigExtension; class ExtensionTest extends TestCase { - /** @var Xhgui_Twig_Extension */ + /** @var TwigExtension */ private $ext; public function setUp() @@ -18,7 +18,7 @@ public function setUp() $app = new Slim(); $app->get('/test', static function () { })->name('test'); - $this->ext = new Xhgui_Twig_Extension($app); + $this->ext = new TwigExtension($app); } public function testFormatBytes() diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 74ef288c8..c0913eaf5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,9 +2,13 @@ /** * Bootstrap for xhgui test suite. */ + +use XHGui\Saver\SaverInterface; +use XHGui\ServiceContainer; + require dirname(__DIR__) . '/src/bootstrap.php'; -$di = Xhgui_ServiceContainer::instance(); +$di = ServiceContainer::instance(); // Use a test database. $config = $di['config']; @@ -17,7 +21,7 @@ /** * Load a fixture into the database. */ -function loadFixture(Xhgui_Saver_Interface $saver, $file) +function loadFixture(SaverInterface $saver, $file) { $data = json_decode(file_get_contents($file), true); foreach ($data as $record) { diff --git a/webroot/index.php b/webroot/index.php index dcf380091..828f93ea3 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -1,7 +1,10 @@