2016-08-18 05:25:54 +02:00
|
|
|
<?php declare(strict_types = 1);
|
2016-08-16 23:39:25 +02:00
|
|
|
|
2015-05-13 16:05:23 +02:00
|
|
|
namespace Amp\Test;
|
|
|
|
|
2016-07-19 07:05:40 +02:00
|
|
|
class StructTestFixture {
|
|
|
|
use \Amp\Struct;
|
|
|
|
public $callback;
|
|
|
|
}
|
|
|
|
|
2015-05-13 16:05:23 +02:00
|
|
|
class StructTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
/**
|
2016-08-12 23:58:53 +02:00
|
|
|
* @expectedException \Error
|
2015-07-30 05:23:53 +02:00
|
|
|
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callbac" does not exist ... did you mean "callback?"
|
2015-05-13 16:05:23 +02:00
|
|
|
*/
|
|
|
|
public function testSetErrorWithSuggestion() {
|
2015-07-30 05:23:53 +02:00
|
|
|
$struct = new StructTestFixture;
|
2015-05-13 16:05:23 +02:00
|
|
|
$struct->callbac = function(){};
|
|
|
|
}
|
2015-07-30 05:23:53 +02:00
|
|
|
|
2015-05-13 16:05:23 +02:00
|
|
|
/**
|
2016-08-12 23:58:53 +02:00
|
|
|
* @expectedException \Error
|
2015-07-30 05:23:53 +02:00
|
|
|
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callbac" does not exist ... did you mean "callback?"
|
2015-05-13 16:05:23 +02:00
|
|
|
*/
|
|
|
|
public function testGetErrorWithSuggestion() {
|
2015-07-30 05:23:53 +02:00
|
|
|
$struct = new StructTestFixture;
|
2015-05-13 16:05:23 +02:00
|
|
|
$test = $struct->callbac;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-08-12 23:58:53 +02:00
|
|
|
* @expectedException \Error
|
2015-07-30 05:23:53 +02:00
|
|
|
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callZZZZZZZZZZZ" does not exist
|
2015-05-13 16:05:23 +02:00
|
|
|
*/
|
|
|
|
public function testSetErrorWithoutSuggestion() {
|
2015-07-30 05:23:53 +02:00
|
|
|
$struct = new StructTestFixture;
|
2015-05-13 16:05:23 +02:00
|
|
|
$struct->callZZZZZZZZZZZ = "test";
|
|
|
|
}
|
2015-07-30 05:23:53 +02:00
|
|
|
|
2015-05-13 16:05:23 +02:00
|
|
|
/**
|
2016-08-12 23:58:53 +02:00
|
|
|
* @expectedException \Error
|
2015-07-30 05:23:53 +02:00
|
|
|
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callZZZZZZZZZZZ" does not exist
|
2015-05-13 16:05:23 +02:00
|
|
|
*/
|
|
|
|
public function testGetErrorWithoutSuggestion() {
|
2015-07-30 05:23:53 +02:00
|
|
|
$struct = new StructTestFixture;
|
2015-05-13 16:05:23 +02:00
|
|
|
$test = $struct->callZZZZZZZZZZZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-08-12 23:58:53 +02:00
|
|
|
* @expectedException \Error
|
2015-07-30 05:23:53 +02:00
|
|
|
* @expectedExceptionMessage Amp\Test\StructTestFixture property "__propertySuggestThreshold" does not exist
|
2015-05-13 16:05:23 +02:00
|
|
|
*/
|
|
|
|
public function testSuggestionIgnoresPropertyStartingWithUnderscore() {
|
2015-07-30 05:23:53 +02:00
|
|
|
$struct = new StructTestFixture;
|
2015-05-13 16:05:23 +02:00
|
|
|
$test = $struct->__propertySuggestThreshold;
|
|
|
|
}
|
|
|
|
}
|