Last active
June 20, 2019 13:23
-
-
Save nesk/343d78c13eee91355e999877d3518eb6 to your computer and use it in GitHub Desktop.
PHPUnit - Data providers memory showcase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/vendor | |
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"phpunit/phpunit": "8.2.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use PHPUnit\Framework\TestCase; | |
class DataProvidersMemoryTest extends TestCase | |
{ | |
/** @dataProvider stringProvider */ | |
public function testStringComplies(string $string): void | |
{ | |
self::assertStringStartsWith('data:', $string); | |
} | |
public function stringProvider(): \Traversable | |
{ | |
for ($i = 0 ; $i < 10000 ; $i++) { | |
yield ['data:'.str_repeat('a', 8192)]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.2/phpunit.xsd" | |
backupGlobals="false" | |
cacheResult="false" | |
> | |
<testsuites> | |
<testsuite name="Project Test Suite"> | |
<file>./DataProvidersMemoryTest.php</file> | |
</testsuite> | |
</testsuites> | |
</phpunit> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment