Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Phalcon\Tests\Integration\Mvc\Model; use DatabaseTester; use Phalcon\Mvc..
Decoded Output download
<?php
namespace Phalcon\Tests\Integration\Mvc\Model; use DatabaseTester; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\MetaData; use Phalcon\Tests\Fixtures\Migrations\CustomersDefaultsMigration; use Phalcon\Tests\Fixtures\Migrations\CustomersMigration; use Phalcon\Tests\Fixtures\Migrations\InvoicesMigration; use Phalcon\Tests\Fixtures\Migrations\SourcesMigration; use Phalcon\Tests\Fixtures\Traits\DiTrait; use Phalcon\Tests\Models\Customers; use Phalcon\Tests\Models\CustomersDefaults; use Phalcon\Tests\Models\CustomersKeepSnapshots; use Phalcon\Tests\Models\Invoices; use Phalcon\Tests\Models\InvoicesKeepSnapshots; use Phalcon\Tests\Models\InvoicesSchema; use Phalcon\Tests\Models\InvoicesValidationFails; use Phalcon\Tests\Models\Sources; use function uniqid; class SaveCest { use DiTrait; public function _before(DatabaseTester $I) { $this->setNewFactoryDefault(); $this->setDatabase($I); } public function _after(DatabaseTester $I) { $this->container["db"]->close(); } public function mvcModelSave(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save()"); $connection = $I->getConnection(); $customersMigration = new CustomersMigration($connection); $customer = new Customers(); $customer->cst_name_first = "cst_test_firstName"; $actual = $customer->save(); $I->assertTrue($actual); $customer->cst_name_last = "cst_test_lastName"; $actual = $customer->save(); $I->assertTrue($actual); $customer = Customers::findFirst(); $expected = array("cst_id" => $customer->cst_id, "cst_status_flag" => null, "cst_name_last" => "cst_test_lastName", "cst_name_first" => "cst_test_firstName"); $actual = $customer->toArray(); $I->assertSame($expected, $actual); $customer->cst_status_flag = 1; $actual = $customer->save(); $I->assertTrue($actual); $customer = Customers::findFirst(); $expected = 1; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); $customer->cst_name_last = null; $actual = $customer->save(); $I->assertTrue($actual); $expected = 1; $actual = Customers::count(); $I->assertSame($expected, $actual); } public function mvcModelSaveWithRelatedRecords(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() with related records"); $invoice = new InvoicesKeepSnapshots(); $invoice->customer = new CustomersKeepSnapshots(); $invoice->customer->assign(array("cst_status_flag" => 0, "cst_name_first" => "cst_test_firstName")); $actual = $invoice->save(); $I->assertTrue($actual); $expected = 0; $actual = $invoice->inv_cst_id; $I->assertGreaterThan($expected, $actual); $expected = $invoice->inv_cst_id; $actual = $invoice->customer->cst_id; $I->assertEquals($expected, $actual); $connection = $this->getService("db"); $actual = $connection->isUnderTransaction(); $I->assertFalse($actual); $expected = Model::DIRTY_STATE_PERSISTENT; $actual = $invoice->getDirtyState(); $I->assertSame($expected, $actual); $expected = Model::DIRTY_STATE_PERSISTENT; $actual = $invoice->customer->getDirtyState(); $I->assertSame($expected, $actual); } public function mvcModelSaveWithRelatedRecordsProperty(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() with related records property"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("inv-", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $invoice = Invoices::findFirst(77); $expected = 1; $actual = $invoice->customer->id; $I->assertEquals($expected, $actual); $invoice->customer->cst_name_first = "new_firstName"; $invoice->customer->cst_status_flag = 0; $actual = $invoice->save(); $I->assertTrue($actual); $customer = Customers::findFirst(1); $expected = "new_firstName"; $actual = $customer->cst_name_first; $I->assertSame($expected, $actual); $expected = 0; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); } public function mvcModelSaveAfterFetchingRelated(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() after fetching related"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("inv-")); $invoicesMigration->insert(88, 1, 1, uniqid("inv-")); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $customersMigration->insert(2, 0, "test_firstName_2", "test_lastName_2"); $invoice = Invoices::findFirst(); $customer = $invoice->customer; $actual = $invoice->save(); $I->assertTrue($actual); $invoices = $customer->invoices; $actual = $customer->save(); $I->assertTrue($actual); } public function mvcModelSaveAfterUsingRelatedGetters(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() after using related records getters"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("inv-")); $invoicesMigration->insert(88, 1, 1, uniqid("inv-")); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $customersMigration->insert(2, 0, "test_firstName_2", "test_lastName_2"); $invoice = Invoices::findFirst(); $customer = $invoice->getCustomer(); $actual = $invoice->save(); $I->assertTrue($actual); $invoices = $customer->getInvoices(); $actual = $customer->save(); $I->assertTrue($actual); } public function mvcModelSaveAfterWithoutDefaultValues(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() when default values are not set"); $connection = $I->getConnection(); $customersMigration = new CustomersDefaultsMigration($connection); $customer = new CustomersDefaults(); $customerData = array("cst_status_flag" => 1); $customer->assign($customerData); $actual = $customer->save(); $I->assertTrue($actual); $metaData = $customer->getModelsMetaData(); $defaultValues = $metaData->getDefaultValues($customer); foreach ($defaultValues as $attribute => $value) { $actual = $customer->{$attribute}; $I->assertEquals($value, $actual); } } public function mvcModelSaveCircularRelation(DatabaseTester $I) { $I->wantToTest("Mvc\Model::save() with circular unsaved relations"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $customersMigration = new CustomersMigration($connection); $invoice = new InvoicesKeepSnapshots(array("inv_title" => "Test invoice")); $customer = new Customers(array("cst_name_last" => "Evil", "cst_name_first" => "Customer")); $invoice->customer = $customer; $customer->invoices = array($invoice); $actual = $customer->save(); $I->assertTrue($actual); $actual = $invoice->inv_id; $I->assertNotNull($actual); $actual = $customer->cst_id; $I->assertNotNull($actual); } public function mvcModelSaveAfterSettingEmptyRelated(DatabaseTester $I) { $I->wantToTest("Mvc\Model::save() after setting empty array"); $connection = $I->getConnection(); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $customer = Customers::findFirst(); $invoice = new InvoicesValidationFails(); $customer->invoices = array($invoice); $customer->invoices = array(); $actual = $customer->save(); $I->assertTrue($actual); $actual = $invoice->save(); $I->assertFalse($actual); } public function mvcModelSaveWithTinyInt(DatabaseTester $I, \Codeception\Example $example) { $I->wantToTest("Mvc\Model::save() with a tinyint(1)"); $customer = new Customers(); $customer->cst_status_flag = $example["value"]; $actual = $customer->save(); $I->assertTrue($actual); $actual = $customer->cst_id; $I->assertNotNull($actual); $storedModel = Customers::findFirstByCstId($customer->cst_id); $expected = $example["value"]; $actual = $storedModel->cst_status_flag; $I->assertEquals($expected, $actual); } public function mvcModelSaveWithSchema(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() with a schema"); $model = new Invoices(); $model->inv_cst_id = 1; $model->inv_status_flag = 1; $model->inv_title = uniqid(); $model->inv_total = 100; $model->inv_created_at = date("Y-m-d H:i:s"); $result = $model->save(); $I->assertNotFalse($result); $model = new InvoicesSchema(); $model->inv_cst_id = 1; $model->inv_status_flag = 1; $model->inv_title = uniqid(); $model->inv_total = 100; $model->inv_created_at = date("Y-m-d H:i:s"); $result = $model->save(); $I->assertNotFalse($result); } public function mvcModelSaveWithPropertySource(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() with property source"); $connection = $I->getConnection(); $sourcesMigration = new SourcesMigration($connection); $sourcesMigration->insert(1, "llama", "test_source"); $model = Sources::findFirst(array("conditions" => "id = :id:", "bind" => array("id" => 1))); $class = Sources::class; $I->assertInstanceOf($class, $model); $expected = 1; $actual = $model->id; $I->assertEquals($expected, $actual); $expected = "co_sources"; $actual = $model->getSource(); $I->assertSame($expected, $actual); $model->username = "vader"; $result = $model->save(); $expected = 0; $actual = $model->getMessages(); $I->assertCount($expected, $actual); $I->assertNotFalse($result); $source = new Sources(); $source->id = 2; $source->username = "llama"; $source->source = "test_source"; $result = $source->create(); $I->assertTrue($result); } public function mvcModelSaveWithRelatedManyAndBelongsRecordsProperty(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() with related records property (relation many - belongs)"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("inv-", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $invoice = InvoicesKeepSnapshots::findFirst(77); $expected = 1; $actual = $invoice->customer->id; $I->assertEquals($expected, $actual); $invoice->customer->cst_name_first = "new_firstName"; $invoice->customer->cst_status_flag = 0; $actual = $invoice->save(); $I->assertTrue($actual); $customer = Customers::findFirst(1); $expected = "new_firstName"; $actual = $customer->cst_name_first; $I->assertSame($expected, $actual); $expected = 0; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); } public function infiniteSaveLoop(DatabaseTester $I) { $I->wantToTest("Mvc\Model - save() infinite Save loop"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("inv-", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "test_firstName_1", "test_lastName_1"); $customer = Customers::findFirst(1); $invoice = Invoices::findFirst(77); $invoice->customer = $customer; $customer->invoices = array($invoice); $customer->save(); } private function tinyintProvider() : array { return array(array("value" => "1"), array("value" => "0"), array("value" => "127")); } } ?>
Did this file decode correctly?
Original Code
<?php
namespace Phalcon\Tests\Integration\Mvc\Model; use DatabaseTester; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\MetaData; use Phalcon\Tests\Fixtures\Migrations\CustomersDefaultsMigration; use Phalcon\Tests\Fixtures\Migrations\CustomersMigration; use Phalcon\Tests\Fixtures\Migrations\InvoicesMigration; use Phalcon\Tests\Fixtures\Migrations\SourcesMigration; use Phalcon\Tests\Fixtures\Traits\DiTrait; use Phalcon\Tests\Models\Customers; use Phalcon\Tests\Models\CustomersDefaults; use Phalcon\Tests\Models\CustomersKeepSnapshots; use Phalcon\Tests\Models\Invoices; use Phalcon\Tests\Models\InvoicesKeepSnapshots; use Phalcon\Tests\Models\InvoicesSchema; use Phalcon\Tests\Models\InvoicesValidationFails; use Phalcon\Tests\Models\Sources; use function uniqid; class SaveCest { use DiTrait; public function _before(DatabaseTester $I) { $this->setNewFactoryDefault(); $this->setDatabase($I); } public function _after(DatabaseTester $I) { $this->container["\x64\142"]->close(); } public function mvcModelSave(DatabaseTester $I) { $I->wantToTest("\x4d\x76\x63\x5c\x4d\157\x64\145\x6c\x20\55\40\163\x61\x76\x65\x28\51"); $connection = $I->getConnection(); $customersMigration = new CustomersMigration($connection); $customer = new Customers(); $customer->cst_name_first = "\143\x73\164\137\164\145\163\x74\137\146\151\162\x73\164\116\x61\x6d\x65"; $actual = $customer->save(); $I->assertTrue($actual); $customer->cst_name_last = "\143\163\164\x5f\x74\x65\x73\164\x5f\154\x61\163\x74\116\141\x6d\x65"; $actual = $customer->save(); $I->assertTrue($actual); $customer = Customers::findFirst(); $expected = array("\143\163\164\x5f\151\144" => $customer->cst_id, "\x63\x73\x74\137\x73\x74\141\164\x75\163\x5f\146\154\x61\147" => null, "\143\x73\164\x5f\x6e\x61\x6d\145\137\x6c\141\163\x74" => "\x63\x73\164\137\164\x65\163\x74\137\154\x61\x73\x74\x4e\x61\155\145", "\143\163\x74\137\x6e\x61\x6d\x65\137\x66\151\x72\163\x74" => "\143\x73\164\x5f\x74\x65\163\164\137\x66\151\162\163\164\116\141\x6d\145"); $actual = $customer->toArray(); $I->assertSame($expected, $actual); $customer->cst_status_flag = 1; $actual = $customer->save(); $I->assertTrue($actual); $customer = Customers::findFirst(); $expected = 1; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); $customer->cst_name_last = null; $actual = $customer->save(); $I->assertTrue($actual); $expected = 1; $actual = Customers::count(); $I->assertSame($expected, $actual); } public function mvcModelSaveWithRelatedRecords(DatabaseTester $I) { $I->wantToTest("\115\x76\143\x5c\115\x6f\144\x65\154\x20\55\40\x73\141\x76\145\x28\x29\40\167\151\164\150\40\x72\145\x6c\x61\x74\x65\x64\40\162\x65\x63\157\162\144\163"); $invoice = new InvoicesKeepSnapshots(); $invoice->customer = new CustomersKeepSnapshots(); $invoice->customer->assign(array("\143\163\164\137\x73\x74\x61\x74\x75\163\x5f\146\154\141\147" => 0, "\143\163\164\137\x6e\141\155\145\x5f\146\151\x72\x73\x74" => "\143\x73\164\137\164\x65\x73\x74\x5f\x66\x69\x72\x73\x74\x4e\x61\x6d\x65")); $actual = $invoice->save(); $I->assertTrue($actual); $expected = 0; $actual = $invoice->inv_cst_id; $I->assertGreaterThan($expected, $actual); $expected = $invoice->inv_cst_id; $actual = $invoice->customer->cst_id; $I->assertEquals($expected, $actual); $connection = $this->getService("\144\x62"); $actual = $connection->isUnderTransaction(); $I->assertFalse($actual); $expected = Model::DIRTY_STATE_PERSISTENT; $actual = $invoice->getDirtyState(); $I->assertSame($expected, $actual); $expected = Model::DIRTY_STATE_PERSISTENT; $actual = $invoice->customer->getDirtyState(); $I->assertSame($expected, $actual); } public function mvcModelSaveWithRelatedRecordsProperty(DatabaseTester $I) { $I->wantToTest("\x4d\x76\143\134\x4d\157\x64\145\154\x20\x2d\x20\x73\141\x76\145\x28\x29\x20\x77\151\x74\x68\x20\x72\145\154\x61\164\x65\144\40\x72\x65\x63\157\x72\144\163\40\160\162\x6f\160\x65\x72\164\x79"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("\151\156\166\55", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\164\x65\163\x74\x5f\146\151\162\163\x74\x4e\141\x6d\x65\x5f\61", "\x74\145\x73\x74\x5f\154\x61\x73\164\116\x61\155\x65\137\x31"); $invoice = Invoices::findFirst(77); $expected = 1; $actual = $invoice->customer->id; $I->assertEquals($expected, $actual); $invoice->customer->cst_name_first = "\156\145\x77\x5f\146\x69\162\163\x74\116\141\155\145"; $invoice->customer->cst_status_flag = 0; $actual = $invoice->save(); $I->assertTrue($actual); $customer = Customers::findFirst(1); $expected = "\156\145\167\x5f\x66\151\162\x73\x74\x4e\x61\x6d\x65"; $actual = $customer->cst_name_first; $I->assertSame($expected, $actual); $expected = 0; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); } public function mvcModelSaveAfterFetchingRelated(DatabaseTester $I) { $I->wantToTest("\x4d\x76\x63\134\115\x6f\x64\145\154\40\55\x20\x73\x61\166\145\50\x29\x20\141\146\164\x65\162\x20\146\145\x74\x63\150\x69\156\147\40\x72\145\x6c\x61\164\145\x64"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("\x69\156\166\55")); $invoicesMigration->insert(88, 1, 1, uniqid("\151\156\166\55")); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\x74\145\163\x74\x5f\x66\151\162\163\x74\x4e\x61\155\x65\137\x31", "\x74\x65\x73\164\x5f\x6c\x61\163\164\x4e\141\155\145\x5f\61"); $customersMigration->insert(2, 0, "\x74\145\163\164\137\x66\151\162\x73\x74\x4e\x61\x6d\x65\137\62", "\164\145\163\164\137\x6c\141\x73\164\116\141\155\x65\137\x32"); $invoice = Invoices::findFirst(); $customer = $invoice->customer; $actual = $invoice->save(); $I->assertTrue($actual); $invoices = $customer->invoices; $actual = $customer->save(); $I->assertTrue($actual); } public function mvcModelSaveAfterUsingRelatedGetters(DatabaseTester $I) { $I->wantToTest("\x4d\166\x63\x5c\x4d\157\x64\x65\154\40\x2d\40\x73\141\166\145\50\x29\x20\x61\146\x74\x65\x72\x20\165\x73\151\156\x67\x20\162\x65\154\141\164\x65\144\x20\x72\145\143\157\162\x64\x73\x20\147\x65\x74\x74\145\162\163"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("\151\156\x76\x2d")); $invoicesMigration->insert(88, 1, 1, uniqid("\151\x6e\166\x2d")); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\164\x65\x73\164\x5f\146\x69\162\x73\x74\116\x61\155\x65\137\x31", "\164\x65\163\164\137\x6c\141\x73\164\x4e\x61\x6d\145\137\x31"); $customersMigration->insert(2, 0, "\x74\145\163\x74\137\x66\151\162\163\x74\116\x61\x6d\145\137\62", "\164\x65\x73\164\x5f\154\141\x73\164\x4e\141\155\145\137\62"); $invoice = Invoices::findFirst(); $customer = $invoice->getCustomer(); $actual = $invoice->save(); $I->assertTrue($actual); $invoices = $customer->getInvoices(); $actual = $customer->save(); $I->assertTrue($actual); } public function mvcModelSaveAfterWithoutDefaultValues(DatabaseTester $I) { $I->wantToTest("\x4d\x76\143\134\115\157\x64\145\154\40\55\x20\163\x61\166\145\50\x29\x20\x77\150\145\x6e\x20\144\x65\x66\x61\165\154\x74\x20\x76\141\154\165\145\163\x20\x61\x72\x65\x20\156\157\x74\40\x73\145\x74"); $connection = $I->getConnection(); $customersMigration = new CustomersDefaultsMigration($connection); $customer = new CustomersDefaults(); $customerData = array("\x63\x73\164\137\163\x74\141\x74\165\x73\137\x66\x6c\141\147" => 1); $customer->assign($customerData); $actual = $customer->save(); $I->assertTrue($actual); $metaData = $customer->getModelsMetaData(); $defaultValues = $metaData->getDefaultValues($customer); foreach ($defaultValues as $attribute => $value) { $actual = $customer->{$attribute}; $I->assertEquals($value, $actual); } } public function mvcModelSaveCircularRelation(DatabaseTester $I) { $I->wantToTest("\x4d\166\x63\x5c\x4d\157\x64\145\x6c\x3a\x3a\163\141\166\145\50\51\40\x77\x69\164\150\40\143\151\162\143\165\x6c\141\162\40\165\156\x73\x61\x76\145\144\x20\162\x65\154\141\164\x69\x6f\x6e\163"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $customersMigration = new CustomersMigration($connection); $invoice = new InvoicesKeepSnapshots(array("\x69\156\166\x5f\x74\x69\164\154\x65" => "\124\x65\x73\x74\x20\151\x6e\x76\x6f\151\x63\145")); $customer = new Customers(array("\143\x73\x74\x5f\156\x61\x6d\145\x5f\x6c\x61\163\164" => "\x45\x76\x69\154", "\x63\x73\164\137\x6e\x61\155\145\137\146\x69\162\163\164" => "\x43\x75\x73\164\157\155\x65\x72")); $invoice->customer = $customer; $customer->invoices = array($invoice); $actual = $customer->save(); $I->assertTrue($actual); $actual = $invoice->inv_id; $I->assertNotNull($actual); $actual = $customer->cst_id; $I->assertNotNull($actual); } public function mvcModelSaveAfterSettingEmptyRelated(DatabaseTester $I) { $I->wantToTest("\x4d\x76\143\134\x4d\157\144\145\154\x3a\x3a\163\x61\x76\x65\x28\x29\x20\141\x66\164\145\162\x20\163\145\x74\x74\151\156\x67\x20\x65\155\x70\164\x79\40\141\162\162\x61\171"); $connection = $I->getConnection(); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\164\x65\x73\164\x5f\146\x69\162\x73\164\x4e\141\x6d\145\x5f\61", "\x74\x65\x73\164\137\x6c\141\x73\164\116\x61\x6d\145\x5f\61"); $customer = Customers::findFirst(); $invoice = new InvoicesValidationFails(); $customer->invoices = array($invoice); $customer->invoices = array(); $actual = $customer->save(); $I->assertTrue($actual); $actual = $invoice->save(); $I->assertFalse($actual); } public function mvcModelSaveWithTinyInt(DatabaseTester $I, \Codeception\Example $example) { $I->wantToTest("\x4d\166\x63\x5c\x4d\x6f\144\145\154\x3a\72\x73\x61\x76\145\x28\x29\40\x77\x69\164\150\x20\x61\x20\164\x69\x6e\x79\151\x6e\x74\50\61\51"); $customer = new Customers(); $customer->cst_status_flag = $example["\166\141\154\x75\145"]; $actual = $customer->save(); $I->assertTrue($actual); $actual = $customer->cst_id; $I->assertNotNull($actual); $storedModel = Customers::findFirstByCstId($customer->cst_id); $expected = $example["\x76\141\x6c\x75\x65"]; $actual = $storedModel->cst_status_flag; $I->assertEquals($expected, $actual); } public function mvcModelSaveWithSchema(DatabaseTester $I) { $I->wantToTest("\115\x76\143\134\115\x6f\x64\x65\154\x20\x2d\x20\x73\141\166\x65\x28\51\40\x77\151\164\x68\40\141\40\x73\143\150\145\155\141"); $model = new Invoices(); $model->inv_cst_id = 1; $model->inv_status_flag = 1; $model->inv_title = uniqid(); $model->inv_total = 100; $model->inv_created_at = date("\131\x2d\x6d\x2d\144\x20\x48\x3a\151\x3a\x73"); $result = $model->save(); $I->assertNotFalse($result); $model = new InvoicesSchema(); $model->inv_cst_id = 1; $model->inv_status_flag = 1; $model->inv_title = uniqid(); $model->inv_total = 100; $model->inv_created_at = date("\131\55\x6d\55\144\x20\x48\72\x69\x3a\163"); $result = $model->save(); $I->assertNotFalse($result); } public function mvcModelSaveWithPropertySource(DatabaseTester $I) { $I->wantToTest("\115\x76\x63\134\115\x6f\144\145\x6c\x20\x2d\40\163\141\166\x65\x28\51\40\167\x69\164\150\40\x70\x72\x6f\160\145\162\x74\x79\x20\163\157\165\x72\143\x65"); $connection = $I->getConnection(); $sourcesMigration = new SourcesMigration($connection); $sourcesMigration->insert(1, "\x6c\154\141\155\x61", "\x74\x65\x73\164\x5f\163\157\165\x72\143\x65"); $model = Sources::findFirst(array("\x63\157\156\x64\151\x74\x69\157\156\x73" => "\x69\144\x20\75\40\72\151\144\72", "\142\x69\x6e\x64" => array("\151\x64" => 1))); $class = Sources::class; $I->assertInstanceOf($class, $model); $expected = 1; $actual = $model->id; $I->assertEquals($expected, $actual); $expected = "\x63\x6f\137\163\157\x75\x72\143\x65\x73"; $actual = $model->getSource(); $I->assertSame($expected, $actual); $model->username = "\x76\141\x64\x65\162"; $result = $model->save(); $expected = 0; $actual = $model->getMessages(); $I->assertCount($expected, $actual); $I->assertNotFalse($result); $source = new Sources(); $source->id = 2; $source->username = "\x6c\x6c\x61\x6d\141"; $source->source = "\x74\145\x73\164\137\x73\157\x75\x72\143\145"; $result = $source->create(); $I->assertTrue($result); } public function mvcModelSaveWithRelatedManyAndBelongsRecordsProperty(DatabaseTester $I) { $I->wantToTest("\115\x76\143\x5c\115\x6f\144\145\x6c\40\55\40\x73\x61\166\145\x28\51\x20\x77\x69\164\150\40\x72\145\154\141\164\x65\x64\x20\x72\x65\143\x6f\x72\144\x73\x20\x70\162\x6f\160\145\x72\164\x79\x20\x28\162\145\x6c\x61\164\151\x6f\x6e\40\155\x61\x6e\171\x20\55\40\142\x65\x6c\157\156\147\x73\x29"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("\151\x6e\166\x2d", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\x74\145\163\x74\x5f\146\x69\x72\163\x74\116\141\155\145\137\61", "\x74\145\163\164\x5f\154\x61\163\x74\116\141\155\145\x5f\x31"); $invoice = InvoicesKeepSnapshots::findFirst(77); $expected = 1; $actual = $invoice->customer->id; $I->assertEquals($expected, $actual); $invoice->customer->cst_name_first = "\156\x65\167\x5f\x66\x69\162\163\x74\x4e\141\x6d\145"; $invoice->customer->cst_status_flag = 0; $actual = $invoice->save(); $I->assertTrue($actual); $customer = Customers::findFirst(1); $expected = "\156\x65\167\137\146\x69\162\x73\164\x4e\x61\155\145"; $actual = $customer->cst_name_first; $I->assertSame($expected, $actual); $expected = 0; $actual = $customer->cst_status_flag; $I->assertEquals($expected, $actual); } public function infiniteSaveLoop(DatabaseTester $I) { $I->wantToTest("\115\x76\x63\x5c\x4d\157\x64\145\154\x20\55\40\163\x61\x76\145\50\51\x20\x69\x6e\x66\x69\x6e\151\x74\145\40\x53\x61\166\x65\40\x6c\157\157\160"); $connection = $I->getConnection(); $invoicesMigration = new InvoicesMigration($connection); $invoicesMigration->insert(77, 1, 0, uniqid("\151\156\166\55", true)); $customersMigration = new CustomersMigration($connection); $customersMigration->insert(1, 1, "\164\x65\x73\164\x5f\146\151\x72\163\164\x4e\141\155\x65\137\x31", "\164\x65\163\164\x5f\154\x61\163\164\116\141\155\x65\x5f\x31"); $customer = Customers::findFirst(1); $invoice = Invoices::findFirst(77); $invoice->customer = $customer; $customer->invoices = array($invoice); $customer->save(); } private function tinyintProvider() : array { return array(array("\x76\x61\154\165\x65" => "\x31"), array("\166\x61\154\165\x65" => "\x30"), array("\166\141\154\x75\x65" => "\61\62\67")); } }
Function Calls
None |
Stats
MD5 | 057fbe0f34b857c69152549cf661bf62 |
Eval Count | 0 |
Decode Time | 117 ms |