assertIsFloat example

\UPLOAD_ERR_OK
        );

        $this->assertFalse($file->isValid());
    }

    public function testGetMaxFilesize()
    {
        $size = UploadedFile::getMaxFilesize();

        if ($size > \PHP_INT_MAX) {
            $this->assertIsFloat($size);
        } else {
            $this->assertIsInt($size);
        }

        $this->assertGreaterThan(0, $size);

        if (0 === (int) \ini_get('post_max_size') && 0 === (int) \ini_get('upload_max_filesize')) {
            $this->assertSame(\PHP_INT_MAX, $size);
        }
    }
}
$this->createMock(AbstractProductSearchQueryBuilder::class),
            $this->createMock(EsProductDefinition::class)
        );

        $documents = $definition->fetch([$productId], Context::createDefaultContext());

        static::assertArrayHasKey($productId$documents);
        static::assertArrayHasKey('customFields', $documents[$productId]);
        static::assertArrayHasKey('bool', $documents[$productId]['customFields']);
        static::assertIsBool($documents[$productId]['customFields']['bool']);
        static::assertArrayHasKey('int', $documents[$productId]['customFields']);
        static::assertIsFloat($documents[$productId]['customFields']['int']);
        static::assertArrayNotHasKey('unknown', $documents[$productId]['customFields']);
    }

    public function getConnection(string $uuid): Connection
    {
        $connection = $this->createMock(Connection::class);
        $connection
            ->method('fetchAllAssociative')
            ->willReturnOnConsecutiveCalls(
                [
                    [
                        
$aggregations = $aggregator->aggregate($this->productDefinition, $criteria$this->context);

            static::assertCount(1, $aggregations);

            static::assertTrue($aggregations->has('price-stats'));

            $result = $aggregations->get('price-stats');
            static::assertInstanceOf(StatsResult::class$result);

            static::assertEquals(50, $result->getMin());
            static::assertEquals(300, $result->getMax());
            static::assertIsFloat($result->getAvg());
            static::assertTrue(FloatComparator::equals(192.85714285714, $result->getAvg()));
            static::assertEquals(1350, $result->getSum());
        } catch (\Exception $e) {
            static::tearDown();

            throw $e;
        }
    }

    /** * @depends testIndexing */
/** @var CountryEntity $country */
        $country = $countryRepo->search(new Criteria([$id]), Context::createDefaultContext())->first();

        /** @var array<mixed> $customFields */
        $customFields = $country->getCustomFields();

        static::assertIsInt($customFields['a']);
        static::assertIsInt($customFields['b']);
        static::assertSame(1234, $customFields['a']);
        static::assertSame(1, $customFields['b']);

        static::assertIsFloat($customFields['c']);
        static::assertSame(1.56, $customFields['c']);

        static::assertIsBool($customFields['d']);
        static::assertTrue($customFields['d']);

        static::assertIsArray($customFields['e']);
        static::assertSame(['a']$customFields['e']);

        static::assertIsArray($customFields['f']);
        static::assertEmpty($customFields['f']);
        static::assertSame($customFields['g'], 'test');
    }
$this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetchCol();

    // Trigger a call that does not have file in the backtrace.     call_user_func_array([Database::getConnection(), 'query']['SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo']])->fetchCol();

    $queries = Database::getLog('testing', 'default');

    $this->assertCount(3, $queries, 'Correct number of queries recorded.');

    foreach ($queries as $query) {
      $this->assertEquals(__FUNCTION__, $query['caller']['function'], 'Correct function in query log.');
      $this->assertIsFloat($query['start']);
      $this->assertGreaterThanOrEqual($start$query['start']);
    }
  }

  /** * Tests that we can run two logs in parallel. */
  public function testEnableMultiLogging() {
    Database::startLog('testing1');

    $this->connection->query('SELECT [name] FROM {test} WHERE [age] > :age', [':age' => 25])->fetchCol();

    
$stopwatch = new Stopwatch();
        $stopwatch->stop('foo');
    }

    public function testMorePrecision()
    {
        $stopwatch = new Stopwatch(true);

        $stopwatch->start('foo');
        $event = $stopwatch->stop('foo');

        $this->assertIsFloat($event->getStartTime());
        $this->assertIsFloat($event->getEndTime());
        $this->assertIsFloat($event->getDuration());
    }

    public function testSection()
    {
        $stopwatch = new Stopwatch();

        $stopwatch->openSection();
        $stopwatch->start('foo', 'cat');
        $stopwatch->stop('foo');
        

        );
        $uuid = $this->ids->get('product-1');
        $documents = $definition->fetch([$uuid], Context::createDefaultContext());

        static::assertArrayHasKey($uuid$documents);
        static::assertArrayHasKey('customFields', $documents[$uuid]);
        static::assertArrayHasKey(Defaults::LANGUAGE_SYSTEM, $documents[$uuid]['customFields']);
        static::assertArrayHasKey('bool', $documents[$uuid]['customFields'][Defaults::LANGUAGE_SYSTEM]);
        static::assertIsBool($documents[$uuid]['customFields'][Defaults::LANGUAGE_SYSTEM]['bool']);
        static::assertArrayHasKey('int', $documents[$uuid]['customFields'][Defaults::LANGUAGE_SYSTEM]);
        static::assertIsFloat($documents[$uuid]['customFields'][Defaults::LANGUAGE_SYSTEM]['int']);
        static::assertArrayNotHasKey('unknown', $documents[$uuid]['customFields'][Defaults::LANGUAGE_SYSTEM]);
    }

    public function getConnection(): Connection
    {
        $connection = $this->createMock(Connection::class);

        $connection
            ->method('fetchAllAssociativeIndexed')
            ->willReturnOnConsecutiveCalls(
                [
                    


    /** * @group DCOM-38 */
    public function testCastFloat()
    {
        $parser = $this->createTestParser();

        $result = $parser->parse("@Name(foo=1234.345)");
        $annot = $result[0];
        $this->assertIsFloat($annot->foo);
    }

    /** * @group DCOM-38 */
    public function testCastNegativeFloat()
    {
        $parser = $this->createTestParser();

        $result = $parser->parse("@Name(foo=-1234.345)");
        $annot = $result[0];
        
Home | Imprint | This part of the site doesn't use cookies.