Skip to content

Commit

Permalink
Merge branch 'phpunit-10-support-62'. Tests now run in phpunit 10. Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfranco committed Aug 12, 2024
2 parents 11ada54 + 74ce907 commit dc8449d
Show file tree
Hide file tree
Showing 88 changed files with 696 additions and 933 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ catalog_prod.sql
docroot/archives
progress.txt
vendor/
.phpunit.result.cache
6 changes: 3 additions & 3 deletions application/resources/Catalog/Action/Helper/Osid.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function getConfigPath () {
* @param string $path
* @access public
* @since 6/11/09
* @throws osid_InvalidStateException The config path has already been set.
* @throws osid_IllegalStateException The config path has already been set.
*/
public function setConfigPath ($path) {
if (isset(self::$configPath))
throw new osid_InvalidStateException('the config path has already been set');
if (isset(self::$configPath) && self::$configPath != $path)
throw new osid_IllegalStateException('the config path has already been set');

self::$configPath = $path;
}
Expand Down
56 changes: 0 additions & 56 deletions application/test/ApplicationTestSuite.php

This file was deleted.

12 changes: 8 additions & 4 deletions application/test/Catalog/Action/Helper/OsidIdTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for Catalog_Action_Helper_OsidId.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidIdTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidIdTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
Expand All @@ -27,7 +31,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand All @@ -51,7 +55,7 @@ public function testGetStringFromOsidId()
{
$id = new phpkit_id_Id('example.edu', 'urn', '123456789/abcd');
$idString = $this->osidIdHelper->toString($id);
$this->assertInternalType('string', $idString);
$this->assertIsString($idString);

$newId = $this->osidIdHelper->fromString($idString);
$this->assertEquals($idString, $this->osidIdHelper->toString($newId));
Expand Down
12 changes: 9 additions & 3 deletions application/test/Catalog/Action/Helper/OsidTermsTest.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for Catalog_Action_Helper_OsidId.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidTermsTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidTermsTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
$this->osidHelper->setConfigPath($this->getTestConfigPath());
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
$this->osidIdHelper = new Catalog_Action_Helper_OsidId();
Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper);
$this->osidTermsHelper = new Catalog_Action_Helper_OsidTerms();
$this->osidHelper->setConfigPath($this->getTestConfigPath());
Zend_Controller_Action_HelperBroker::addHelper($this->osidTermsHelper);

$this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG');
Expand All @@ -36,7 +42,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand Down
10 changes: 7 additions & 3 deletions application/test/Catalog/Action/Helper/OsidTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for AbstractCatalogController.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
Expand All @@ -25,7 +29,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand Down
15 changes: 10 additions & 5 deletions application/test/Catalog/Action/Helper/OsidTopicTest.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for AbstractCatalogController.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidTopicTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidTopicTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
$this->osidHelper->setConfigPath($this->getTestConfigPath());
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
$this->osidIdHelper = new Catalog_Action_Helper_OsidId();
Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper);
Expand All @@ -33,7 +38,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand All @@ -45,7 +50,7 @@ public function testTopicListAsArray()
$topics = $this->topicLookup->getTopics();
$numTopics = $topics->available();
$topicArray = $this->osidTopicHelper->topicListAsArray($topics);
$this->assertInternalType('array', $topicArray);
$this->assertIsArray($topicArray);
$this->assertEquals($numTopics, count($topicArray));
$this->assertInstanceOf('osid_course_Topic', $topicArray[0]);
}
Expand All @@ -62,7 +67,7 @@ public function testFilterTopicsByType()
$subjectType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/subject");

$filteredTopics = $this->osidTopicHelper->filterTopicsByType($topicArray, $subjectType);
$this->assertInternalType('array', $filteredTopics);
$this->assertIsArray($filteredTopics);
$this->assertLessThan($numTopics, count($filteredTopics));
$this->assertEquals(4, count($filteredTopics));
$this->assertInstanceOf('osid_course_Topic', $filteredTopics[0]);
Expand Down
12 changes: 8 additions & 4 deletions application/test/Catalog/Action/Helper/OsidTypeTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for Catalog_Action_Helper_OsidId.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidTypeTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidTypeTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
Expand All @@ -29,7 +33,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand All @@ -53,7 +57,7 @@ public function testGetStringFromOsidType()
{
$type = new phpkit_type_Type('urn', 'example.edu', '123456789/abcd');
$typeString = $this->osidTypeHelper->toString($type);
$this->assertInternalType('string', $typeString);
$this->assertIsString($typeString);

$newType = $this->osidTypeHelper->fromString($typeString);
$this->assertEquals($typeString, $this->osidTypeHelper->toString($newType));
Expand Down
10 changes: 7 additions & 3 deletions application/test/Catalog/Action/Helper/OsidTypesTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for Catalog_Action_Helper_OsidId.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class Catalog_Action_Helper_OsidTypesTest extends PHPUnit_Framework_TestCase
class Catalog_Action_Helper_OsidTypesTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
$this->osidHelper = new Catalog_Action_Helper_Osid();
Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper);
Expand All @@ -29,7 +33,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand Down
26 changes: 26 additions & 0 deletions application/test/Catalog/ApplicationTestTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

trait Catalog_ApplicationTestTrait {

use banner_DatabaseTestTrait;

public static function setUpBeforeClass(): void
{
self::setUpDatabase();

Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH.'/controllers/helper', 'Helper');
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH.'/resources/Catalog/Action/Helper', 'Catalog_Action_Helper');
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH.'/resources/Auth/Action/Helper', 'Auth_Action_Helper');

$registry = Zend_Registry::getInstance();
$registry->config = new Zend_Config_Ini(dirname(__FILE__).'/frontend_config.ini', 'development');
}

/**
* Answer the configuration path to be used when running tests.
*/
public function getTestConfigPath() {
return dirname(__FILE__).'/../apc/configuration.plist';
}

}
10 changes: 7 additions & 3 deletions application/test/Catalog/View/Helper/GetTimeStringHelperTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Test class for AbstractCatalogController.
* Generated by PHPUnit on 2009-06-11 at 09:36:05.
*/
class GetTimeStringHelperTest extends PHPUnit_Framework_TestCase
class GetTimeStringHelperTest extends TestCase
{

use Catalog_ApplicationTestTrait;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
protected function setUp(): void
{
require_once(APPLICATION_PATH.'/views/helpers/GetTimeString.php');
$this->helper = new Catalog_View_Helper_GetTimeString;
Expand All @@ -25,7 +29,7 @@ protected function setUp()
*
* @access protected
*/
protected function tearDown()
protected function tearDown(): void
{
}

Expand Down
Loading

0 comments on commit dc8449d

Please sign in to comment.