Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to fully Composer-based installation #75

Merged
merged 2 commits into from Jun 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -11,7 +11,7 @@ env:
before_script:
- ./tests/travis_${MIDGARD}.sh

script: phpunit -c tests/phpunit.xml.dist
script: phpunit

notifications:
irc: "irc.freenode.org#midgard"
6 changes: 4 additions & 2 deletions composer.json
Expand Up @@ -3,8 +3,7 @@
"type": "library",
"description": "Content-oriented Model-View-Controller library for PHP",
"keywords": ["mvc", "midgard", "framework"],
"homepage": "http://new.midgard-project.org/midgardmvc/",
"version": "10.05.2",
"homepage": "http://midgard-project.org/midgardmvc/",
"license": "LGPL",
"authors": [
{
Expand All @@ -19,5 +18,8 @@
},
"suggest": {
"ext-midgard2": ">=10.05.5"
},
"autoload": {
"classmap": ["."]
}
}
3 changes: 1 addition & 2 deletions framework.php
Expand Up @@ -53,5 +53,4 @@
require(__DIR__ . '/interface.php');

// Register autoloader so we get all Midgard MVC classes loaded automatically
spl_autoload_register(array('midgardmvc_core', 'autoload'));
?>
require(__DIR__ . '/vendor/autoload.php');
38 changes: 0 additions & 38 deletions interface.php
Expand Up @@ -175,25 +175,6 @@ public function __get($key)
return $this->$key;
}

/**
* Automatically load missing class files
*
* @param string $class_name Name of a missing PHP class
*/
public static function autoload($class_name)
{
$components = self::find_components();
foreach ($components as $component => $component_path)
{
$component_length = strlen($component);
if (substr($class_name, 0, $component_length) != $component)
{
continue;
}
return self::autoload_from_component($component, substr($class_name, $component_length));
}
}

private static function find_components()
{
static $components = null;
Expand Down Expand Up @@ -246,25 +227,6 @@ public static function get_component_path($component)
}
}

private static function autoload_from_component($component, $class_name)
{
if (empty($class_name))
{
$path = self::get_component_path($component) . '/interface.php';
}
else
{
$path = self::get_component_path($component) . str_replace('_', '/', $class_name) . '.php';
}

if (!file_exists($path))
{
return;
}

require($path);
}

/**
* Process the current request, loading the node's component and dispatching the request to it
*/
Expand Down
12 changes: 0 additions & 12 deletions phptal_include.php

This file was deleted.

12 changes: 12 additions & 0 deletions phpunit.xml.dist
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
colors="true"
bootstrap="framework.php"
>
<testsuites>
<testsuite name="Midgard MVC Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
1 change: 0 additions & 1 deletion services/i18n/gettext.php
Expand Up @@ -5,7 +5,6 @@
* @copyright The Midgard Project, http://www.midgard-project.org
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
*/
require_once(midgardmvc_core::get_component_path('midgardmvc_core') . '/phptal_include.php');

/**
* Gettext localization service for Midgard MVC
Expand Down
6 changes: 0 additions & 6 deletions services/templating/midgardmvc.php
Expand Up @@ -279,12 +279,6 @@ public function display(midgardmvc_core_request $request, $return_output = false

private function display_tal(midgardmvc_core_request $request, $content, array $data)
{
// We use the PHPTAL class
if (!class_exists('PHPTAL'))
{
require_once(midgardmvc_core::get_component_path('midgardmvc_core') . '/phptal_include.php');
}

$tal = new PHPTAL($request->get_template_identifier());
$tal->setPhpCodeDestination($this->midgardmvc->cache->template->get_cache_directory());

Expand Down
44 changes: 0 additions & 44 deletions tests/all.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/core.php → tests/coreTest.php
Expand Up @@ -9,7 +9,7 @@
/**
* Test to see if midgardmvc_core is working
*/
class midgardmvc_core_tests_core extends PHPUnit_Framework_TestCase
class midgardmvc_core_tests_coreTest extends PHPUnit_Framework_TestCase
{
private $configuration = array
(
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_exceptionhandler extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_exceptionhandlerTest extends midgardmvc_core_tests_testcase
{
public function test_handle()
{
Expand Down
72 changes: 0 additions & 72 deletions tests/helpers.php

This file was deleted.

Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_helpers_context extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_helpers_contextTest extends midgardmvc_core_tests_testcase
{
public function test_create()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/head.php → tests/helpers/headTest.php
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_helpers_head extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_helpers_headTest extends midgardmvc_core_tests_testcase
{
public function test_jquery()
{
Expand Down
19 changes: 0 additions & 19 deletions tests/phpunit.xml.dist

This file was deleted.

Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_providers_component extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_providers_componentTest extends midgardmvc_core_tests_testcase
{
/**
* @expectedException InvalidArgumentException
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_providers_hierarchy extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_providers_hierarchyTest extends midgardmvc_core_tests_testcase
{
public function test_get_node_by_path()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/request.php → tests/requestTest.php
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_request extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_requestTest extends midgardmvc_core_tests_testcase
{
public function test_resolve_node_root()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/route.php → tests/routeTest.php
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_route extends PHPUnit_Framework_TestCase
class midgardmvc_core_tests_routeTest extends PHPUnit_Framework_TestCase
{
public function test_default_templates()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_authentication extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_authenticationTest extends midgardmvc_core_tests_testcase
{
public function test_user_anonymous()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_configuration extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_configurationTest extends midgardmvc_core_tests_testcase
{
public function setUp()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_dispatcher extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_dispatcherTest extends midgardmvc_core_tests_testcase
{
public function test_generate_url()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_observation extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_observationTest extends midgardmvc_core_tests_testcase
{
public function test_update_node()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_templating extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_templatingTest extends midgardmvc_core_tests_testcase
{
public function setUp()
{
Expand Down
Expand Up @@ -11,7 +11,7 @@
*
* @package midgardmvc_core
*/
class midgardmvc_core_tests_services_uimessages extends midgardmvc_core_tests_testcase
class midgardmvc_core_tests_services_uimessagesTest extends midgardmvc_core_tests_testcase
{
public function test_has_remove()
{
Expand Down