Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed Mar 22, 2023
1 parent ce5932c commit 641b464
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions tests/VisualCaptchaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,7 @@ class VisualCaptchaTest extends TestCase
'noise_pixel_min' => '500'
];

/**
* @var VisualCaptcha
*/
private $subject;

public function setUp(): void
{
$this->setUpFilesystem();
mt_srand(12345);
$this->subject = new VisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', self::CONFIG);
}

private function setUpFilesystem()
{
vfsStream::setup('test');
mkdir(vfsStream::url('test/images'), 0777, true);
Expand All @@ -84,7 +72,7 @@ public function testCreateImage()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', self::CONFIG);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -93,7 +81,7 @@ public function testCreateErrorImage()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', self::CONFIG);
$actual = $sut->createErrorImage('Cookies must be enabled!');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -103,7 +91,7 @@ public function testNoiseAbove()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', $config);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -113,7 +101,7 @@ public function testCryptGrayScale()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', $config);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -123,7 +111,7 @@ public function testCryptGaussianBlur()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', $config);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -134,7 +122,7 @@ public function testBgImagePng()
$this->createYellowBackgroundImage("png");
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -145,7 +133,7 @@ public function testBgImageGif()
$this->createYellowBackgroundImage("gif");
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -156,7 +144,7 @@ public function testBgImageJpeg()
$this->createYellowBackgroundImage("jpeg");
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -168,7 +156,7 @@ public function testBgImages()
$this->createYellowBackgroundImage('gif');
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -190,7 +178,7 @@ public function testNoiseColor1()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', $config);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -200,7 +188,7 @@ public function testNoiseColor2()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', $config);
$actual = $sut->createImage('ABCD');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}

Expand All @@ -212,7 +200,7 @@ public function testWordwrapInErrorImage()
$sut = new FakeVisualCaptcha(vfsStream::url('test/images/'), '../cryptographp/fonts', self::CONFIG);
$actual = $sut->createErrorImage('Перезагрузка слишком быстро!');
ob_start();
imagegif($actual, null, false);
imagegif($actual);
Approvals::verifyStringWithFileExtension(ob_get_clean(), "gif");
}
}

0 comments on commit 641b464

Please sign in to comment.