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

75 lines
2.5 KiB
PHP

<?php
namespace Ddeboer\DataImport\Tests;
use Ddeboer\DataImport\Result;
/**
* Tests For Workflow Result
*
* @author Aydin Hassan <aydin@hotmail.co.uk>
*/
class ResultTest extends \PHPUnit_Framework_TestCase
{
public function testResultName()
{
$result = new Result('export', new \DateTime, new \DateTime, 10, new \SplObjectStorage());
$this->assertSame('export', $result->getName());
}
public function testResultCounts()
{
$result = new Result('export', new \DateTime, new \DateTime, 10, new \SplObjectStorage());
$this->assertSame(10, $result->getTotalProcessedCount());
$this->assertSame(10, $result->getSuccessCount());
$this->assertSame(0, $result->getErrorCount());
$exceptions = new \SplObjectStorage();
$exceptions->attach(new \Exception());
$exceptions->attach(new \Exception());
$result = new Result('export', new \DateTime, new \DateTime, 10, $exceptions);
$this->assertSame(10, $result->getTotalProcessedCount());
$this->assertSame(8, $result->getSuccessCount());
$this->assertSame(2, $result->getErrorCount());
}
public function testDates()
{
$startDate = new \DateTime("22-07-2014 22:00");
$endDate = new \DateTime("22-07-2014 23:30");
$result = new Result('export', $startDate, $endDate, 10, new \SplObjectStorage());
$this->assertSame($startDate, $result->getStartTime());
$this->assertSame($endDate, $result->getEndTime());
$this->assertInstanceOf('DateInterval', $result->getElapsed());
}
public function testHasErrorsReturnsTrueIfAnyExceptions()
{
$exceptions = new \SplObjectStorage();
$exceptions->attach(new \Exception());
$exceptions->attach(new \Exception());
$result = new Result('export', new \DateTime, new \DateTime, 10, $exceptions);
$this->assertTrue($result->hasErrors());
}
public function testHasErrorsReturnsFalseIfNoExceptions()
{
$result = new Result('export', new \DateTime, new \DateTime, 10, new \SplObjectStorage());
$this->assertFalse($result->hasErrors());
}
public function testGetExceptions()
{
$exceptions = new \SplObjectStorage();
$exceptions->attach(new \Exception());
$exceptions->attach(new \Exception());
$result = new Result('export', new \DateTime, new \DateTime, 10, $exceptions);
$this->assertSame($exceptions, $result->getExceptions());
}
}