You are here

public function StateTest::testProgress in Feeds 8.3

Tests public progress property.

File

tests/src/Unit/StateTest.php, line 17

Class

StateTest
@coversDefaultClass \Drupal\feeds\State @group feeds

Namespace

Drupal\Tests\feeds\Unit

Code

public function testProgress() {
  $state = new State();
  $state
    ->progress(10, 10);
  $this
    ->assertSame(StateInterface::BATCH_COMPLETE, $state->progress);
  $state
    ->progress(20, 10);
  $this
    ->assertSame(0.5, $state->progress);
  $state
    ->progress(10, 30);
  $this
    ->assertSame(StateInterface::BATCH_COMPLETE, $state->progress);
  $state
    ->progress(0, 0);
  $this
    ->assertSame(StateInterface::BATCH_COMPLETE, $state->progress);
  $state
    ->progress(PHP_INT_MAX, PHP_INT_MAX - 1);
  $this
    ->assertSame(0.99, $state->progress);
}