Files
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

69 lines
2.0 KiB
PHP

<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer\Tests;
use PHPUnit\Framework\TestCase;
abstract class SerializerTest extends TestCase
{
protected function buildSerializeTestCases($objectType)
{
$tests = array();
$phpFixturesClass = 'Xabbuh\XApi\DataFixtures\\'.$objectType.'Fixtures';
$jsonFixturesClass = 'XApi\Fixtures\Json\\'.$objectType.'JsonFixtures';
$jsonFixturesMethods = get_class_methods($jsonFixturesClass);
foreach (get_class_methods($phpFixturesClass) as $method) {
if (false !== strpos($method, 'ForQuery')) {
continue;
}
// serialized data will always contain type information
if (in_array($method.'WithType', $jsonFixturesMethods)) {
$jsonMethod = $method.'WithType';
} else {
$jsonMethod = $method;
}
$tests[$method] = array(
call_user_func(array($phpFixturesClass, $method)),
call_user_func(array($jsonFixturesClass, $jsonMethod)),
);
}
return $tests;
}
protected function buildDeserializeTestCases($objectType)
{
$tests = array();
$jsonFixturesClass = 'XApi\Fixtures\Json\\'.$objectType.'JsonFixtures';
$phpFixturesClass = 'Xabbuh\XApi\DataFixtures\\'.$objectType.'Fixtures';
foreach (get_class_methods($jsonFixturesClass) as $method) {
// PHP objects do not contain the type information as a dedicated property
if ('WithType' === substr($method, -8)) {
continue;
}
$tests[$method] = array(
call_user_func(array($jsonFixturesClass, $method)),
call_user_func(array($phpFixturesClass, $method)),
);
}
return $tests;
}
}