BatchController example

$container['cleanup.files.finder'] = function D) {
            return new CleanupFilesFinder(SW_PATH);
        };

        $container['system.locker'] = function D) {
            return new SystemLocker(
                SW_PATH . DIRECTORY_SEPARATOR . 'recovery' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'install.lock'
            );
        };

        $container['controller.batch'] = function D) use ($me) {
            return new BatchController(
                $me->get('slim.request'),
                $me->get('slim.response'),
                $me
            );
        };

        $container['controller.requirements'] = function D) use ($me) {
            return new RequirementsController(
                $me->get('slim.request'),
                $me->get('slim.response'),
                $me,
                

class BatchControllerTest extends UnitTestCase {

  /** * Tests title callback. * * @covers ::batchPageTitle */
  public function testBatchPageTitle() {
    $batch_storage = $this->createMock(BatchStorageInterface::class);
    $controller = new BatchController($this->root, $batch_storage);
    require_once $this->root . '/core/includes/form.inc';
    $this->assertSame('', $controller->batchPageTitle(new Request()));
    // Test no batch loaded from storage and batch loaded from storage cases.     $batch = ['sets' => [['title' => 'foobar']], 'current_set' => 0];
    $batch_storage->method('load')->will($this->onConsecutiveCalls(FALSE, $batch));
    $this->assertSame('', $controller->batchPageTitle(new Request(['id' => 1234])));
    $this->assertSame('foobar', $controller->batchPageTitle(new Request(['id' => 1234])));
    // Test batch returned by &batch_get() call.     $batch = &batch_get();
    $batch['sets']['0']['title'] = 'Updated title';
    $this->assertSame('Updated title', $controller->batchPageTitle(new Request(['id' => 1234])));
  }
Home | Imprint | This part of the site doesn't use cookies.