public function testCreate() { $chargeForm = new ChargeForm(); $chargeForm->load(require 'data/charge.php', ''); $this->assertTrue($chargeForm->validate()); $data = $chargeForm->create()->__toArray(); $this->assertTrue(is_array($data)); $reflectionClass = new ReflectionClass('\\idarex\\pingppyii2\\CodeAutoCompletion\\Charge'); $properties = $reflectionClass->getDefaultProperties(); $this->assertTrue(array_diff_key($data, $properties) == []); }
/** * @depends testCreate */ public function testCreateWithPrivateKey() { $config = Yii::$app->getComponents()['pingpp']; $config['privateKey'] = file_get_contents(dirname(__FILE__) . '/rsa_private_key.pem'); $component = Yii::createObject($config); $chargeForm = new ChargeForm(); $chargeForm->component = $component; $chargeForm->load(require 'data/charge.php', ''); $this->assertTrue($chargeForm->validate() && $chargeForm->create()); $this->assertTrue(is_array($chargeForm->getCharge(true))); }